ftp:connect:未知錯誤號碼解決 預設情況下不需要修改就可以在虛擬機器上訪問的,如: Python代碼 [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> www.2cto.com Python代碼 [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> www.2cto.com 不過,先別高興太早,這隻是在本虛擬機器上可以訪問,在宿主機上呢,我用的是xp 通過cmd命令會出現如下錯誤 Python代碼 C:\Documents and Settings\Administrator>ftp 10.4.141.15 > ftp: connect :未知錯誤號碼 Python代碼 C:\Documents and Settings\Administrator>ftp 10.4.141.15 > ftp: connect :未知錯誤號碼 10.4.141.15是我的虛擬機器Linux的ip地址 當然此時要保證宿主機和虛擬機器能相互ping通! 針對這個錯誤,我們應該進行如下設定 將Linux的防火牆關掉,如下命令: www.2cto.com Python代碼 service iptables stop Python代碼 service iptables stop 停掉防火牆以後還是不能訪問,此時我們就要考慮防火牆表面上關掉了,其實底部還有
某些驅動在運行,這就是我們的21連接埠還被防火牆限制訪問,所以我們要開放21連接埠,命令如下: iptables -A INPUT -p tcp -sport 21 -j ACCEPT iptables -A INPUT -p tcp -dport 21 -j ACCEPT 至此,我們就可以在用戶端訪問我們的sftpd服務了,剩下的設定就簡單了,存取權限之類的。