免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1634 | 回复: 2
打印 上一主题 下一主题

登陆vsftpd后提示425 Security: Bad IP connecting [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-02-10 00:05 |只看该作者 |倒序浏览
机器在一个路由后面。路由上做的NAT,断口已经映射到vsftpd所在服务器
通过路由器的公网IP访问,能登陆,不能列目录、下载


  1. [root@www vsftpd]# ftp 61.52.112.30 2121
  2. Connected to 61.52.112.30.
  3. 220 ▒▒ӭ▒▒▒ ▒▒FTP▒▒▒▒▒▒
  4. 530 Please login with USER and PASS.
  5. 530 Please login with USER and PASS.
  6. KERBEROS_V4 rejected as an authentication type
  7. Name (61.52.112.30:root): ftpuser
  8. 331 Please specify the password.
  9. Password:
  10. 230 Login successful.
  11. Remote system type is UNIX.
  12. Using binary mode to transfer files.
  13. ftp> ls
  14. 227 Entering Passive Mode (192,168,0,9,195,83)
  15. 425 Security: Bad IP connecting.
  16. ftp> pwd
  17. 257 "/"
  18. ftp> size 1111
  19. 213 0
  20. ftp> get 1111
  21. local: 1111 remote: 1111
  22. 227 Entering Passive Mode (192,168,0,9,195,83)
  23. 425 Security: Bad IP connecting.
  24. ftp> bye
  25. 221 Goodbye.
复制代码

但是直接在内网连vsftpd所在的服务器可以下载

  1. [root@www vsftpd]# ftp 192.168.0.9 2121
  2. Connected to 192.168.0.9.
  3. 220 ▒▒ӭ▒▒▒ ▒▒FTP▒▒▒▒▒▒
  4. 530 Please login with USER and PASS.
  5. 530 Please login with USER and PASS.
  6. KERBEROS_V4 rejected as an authentication type
  7. Name (192.168.0.9:root): ftpuser
  8. 331 Please specify the password.
  9. Password:
  10. 230 Login successful.
  11. Remote system type is UNIX.
  12. Using binary mode to transfer files.
  13. ftp> pwd
  14. 257 "/"
  15. ftp> ls
  16. 227 Entering Passive Mode (192,168,0,9,195,80)
  17. 150 Here comes the directory listing.
  18. -rw-rw-rw-    1 ftp      ftp             0 Feb 09 22:52 1111
  19. drwxrwxrwx    2 ftp      ftp          4096 Feb 09 18:12 pub
  20. 226 Directory send OK.
  21. ftp> get 1111
  22. local: 1111 remote: 1111
  23. 227 Entering Passive Mode (192,168,0,9,195,82)
  24. 150 Opening BINARY mode data connection for 1111 (0 bytes).
  25. 226 File send OK.
  26. ftp> bye
  27. 221 Goodbye.
复制代码

这是我的vsftpd.conf

  1. [root@www vsftpd]# cat vsftpd.conf
  2. listen=YES
  3. listen_port=2121

  4. port_enable=NO
  5. pasv_enable=YES
  6. pasv_min_port=50000
  7. pasv_max_port=50009

  8. ascii_upload_enable=NO
  9. ascii_download_enable=NO

  10. idle_session_timeout=120
  11. data_connection_timeout=120
  12. accept_timeout=60

  13. max_clients=100
  14. max_per_ip=2

  15. anonymous_enable=NO
  16. anon_upload_enable=NO
  17. anon_mkdir_write_enable=NO
  18. anon_other_write_enable=NO

  19. local_enable=YES
  20. local_root=/home/vsftpdvirtual/

  21. guest_enable=YES
  22. guest_username=vsftpdvirtual

  23. pam_service_name=vsftpd
  24. userlist_enable=YES
  25. userlist_file=/etc/vsftpd.user_list
  26. userlist_deny=NO
  27. tcp_wrappers=NO

  28. #chroot_list_enable=YES
  29. #chroot_list_file=/etc/vsftpd/chroot_list
  30. ##chroot_local_users=NO

  31. hide_ids=YES
  32. ls_recurse_enable=NO
  33. write_enable=YES

  34. file_open_mode=0666
  35. local_umask=022

  36. ftpd_banner=▒▒ӭ▒▒▒ ▒▒FTP▒▒▒▒▒▒
  37. banner_file=/etc/vsftpd/vsftpd_banner_file
  38. dirmessage_enable=YES

  39. xferlog_enable=YES
  40. xferlog_file=/var/log/vsftpd.log
  41. xferlog_std_format=NO
  42. log_ftp_protocol=NO

  43. setproctitle_enable=NO
  44. #text_userdb_names=YES
  45. use_localtime=YES
复制代码

这是我的vsftpd的pam配置文件

  1. [root@www vsftpd]# cat /etc/pam.d/vsftpd
  2. #%PAM-1.0
  3. auth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd.ftpusers onerr=succeed
  4. #auth       required    pam_stack.so service=system-auth
  5. #auth       required    pam_shells.so
  6. #account    required    pam_stack.so service=system-auth
  7. #session    required    pam_stack.so service=system-auth
  8. #session    required     pam_loginuid.so
  9. auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/account
  10. account required /lib64/security/pam_userdb.so db=/etc/vsftpd/account
复制代码

ftp的根目录已经是所有人可读写执行

  1. drwxrwxrwx  3 vsftpdvirtual vsftpdvirtual  4096  2月  9 23:05 vsftpdvirtual
复制代码

感觉还是虚拟用户、pam认证这一块出错了,但是不知道该怎么弄了,郁闷阿,谁来帮帮我。谢谢

[ 本帖最后由 cnhnln 于 2006-2-10 00:08 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-02-10 14:40 |只看该作者
先看看ftp主动、被动方式的原理
http://bbs.chinaunix.net/forum/v ... 8980&show_type=

问题是外网连接时没法进入被动模式
227 Entering Passive Mode (192,168,0,9,195,83)
425 Security: Bad IP connecting.

看到没有,vsftpd返回的是内网IP
这个要在vsftpd.conf里设置成你的nat后的ip
pasv_address=61.52.112.30

参考: http://vsftpd.beasts.org/vsftpd_conf.html里这几个选项
pasv_enable
pasv_max_port
pasv_min_port
pasv_address

论坛徽章:
0
3 [报告]
发表于 2006-02-10 17:59 |只看该作者
谢谢您,不过还是不行啊

  1. [root@www vsftpd]# nano vsftpd.conf
  2. [root@www vsftpd]# /etc/init.d/vsftpd restart
  3. 关闭 vsftpd:                                              [  确定  ]
  4. 为 vsftpd 启动 vsftpd:                                    [  确定  ]
  5. [root@www vsftpd]# ftp 61.52.112.30 2121
  6. Connected to 61.52.112.30.
  7. 220 ▒▒ӭ▒▒▒ ▒▒FTP▒▒▒▒▒▒
  8. 530 Please login with USER and PASS.
  9. 530 Please login with USER and PASS.
  10. KERBEROS_V4 rejected as an authentication type
  11. Name (61.52.112.30:root): ftpuser
  12. 331 Please specify the password.
  13. Password:
  14. 230 Login successful.
  15. Remote system type is UNIX.
  16. Using binary mode to transfer files.
  17. ftp> ftp
  18. ?Invalid command
  19. ftp> pwd
  20. 257 "/"
  21. ftp> ls
  22. 227 Entering Passive Mode (61,52,112,30,195,87)
  23. ftp: connect: Connection refused
  24. ftp> size 1111
  25. 213 0
  26. ftp> cd pub
  27. 250 Directory successfully changed.
  28. ftp> pwd
  29. 257 "/pub"
  30. ftp> ls
  31. 227 Entering Passive Mode (61,52,112,30,195,84)
  32. ftp: connect: Connection refused
  33. ftp> bye
  34. 221 Goodbye.
复制代码


这是在服务器上登陆的,一样还是错误。而且改过以后用内网IP登陆也不能列目录了,改之前用内网IP是可以的。会不会是路由器上的问题啊?(路由器上已经映射过端口了)


  1. [root@www vsftpd]# ftp 192.168.0.9 2121
  2. Connected to 192.168.0.9.
  3. 220 ▒▒ӭ▒▒▒ www.linuxdown.org ▒▒FTP▒▒▒▒▒▒
  4. 530 Please login with USER and PASS.
  5. 530 Please login with USER and PASS.
  6. KERBEROS_V4 rejected as an authentication type
  7. Name (192.168.0.9:root): ftpuser
  8. 331 Please specify the password.
  9. Password:
  10. 230 Login successful.
  11. Remote system type is UNIX.
  12. Using binary mode to transfer files.
  13. ftp> ls
  14. 227 Entering Passive Mode (61,52,112,30,195,82)
  15. 425 Security: Bad IP connecting.
  16. ftp> cd pub
  17. 250 Directory successfully changed.
  18. ftp> ls
  19. 227 Entering Passive Mode (61,52,112,30,195,84)
  20. ftp: connect: Connection refused
  21. ftp> bye
  22. 221 Goodbye.
复制代码

[ 本帖最后由 cnhnln 于 2006-2-10 18:07 编辑 ]

nat-1.jpg (22.47 KB, 下载次数: 14)

nat-1.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP