ftp:connect:未知错误号 (或者530 Permission denied.)

默认情况下不需要修改就可以在虚拟机上访问的,如: 

Python代码 复制代码  收藏代码
  1. [root@tong vsftpd]# ftp 127.0.0.1    
  2. Connected to 127.0.0.1 (127.0.0.1).    
  3. 220 (vsFTPd 2.1.2)    
  4. Name (127.0.0.1:tong): ftp//匿名登录默认用户名,密码也是;也可都用anonymous    
  5. 331 Please specify the password.    
  6. Password:    
  7. 230 Login successful. //恭喜您,已成功登陆    
  8. Remote system type is UNIX.    
  9. Using binary mode to transfer files.    
  10. ftp>   
[root@tong vsftpd]# ftp 127.0.0.1 
Connected to 127.0.0.1 (127.0.0.1). 
220 (vsFTPd 2.1.2) 
Name (127.0.0.1:tong): ftp//匿名登录默认用户名,密码也是;也可都用anonymous 
331 Please specify the password. 
Password: 
230 Login successful. //恭喜您,已成功登陆 
Remote system type is UNIX. 
Using binary mode to transfer files. 
ftp> 

 
不过,先别高兴太早,这只是在本虚拟机上可以访问,在宿主机上呢,我用的是xp 
通过cmd命令会出现如下错误 

Python代码 复制代码  收藏代码
  1. C:\Documents and Settings\Administrator>ftp 10.4.141.15    
  2. > ftp: connect :未知错误号   
C:\Documents and Settings\Administrator>ftp 10.4.141.15 
> ftp: connect :未知错误号 

 
10.4.141.15是我的虚拟机Linux的ip地址 
当然此时要保证宿主机和虚拟机能相互ping通! 
针对这个错误,我们应该进行如下设置 
将Linux的防火墙关掉,如下命令: 
 

Python代码 复制代码  收藏代码
  1. service iptables stop   
service iptables stop 

停掉防火墙以后还是不能访问,此时我们就要考虑防火墙表面上关掉了,其实底部还有某些驱动在运行,这就是我们的21端口还被防火墙限制访问,所以我们要开放21端口,命令如下: 
iptables -A INPUT -p tcp -sport 21 -j ACCEPT 
iptables -A INPUT -p tcp -dport 21 -j ACCEPT 

至此,我们就可以在客户端访问我们的sftpd服务了,剩下的设置就简单了,访问权限之类的。。。

猜你喜欢

转载自sefcertyu.iteye.com/blog/1709504