Ubuntu 12.04 LTS で FTP サーバーをセットアップしました。
Windows 7 からコマンドライン経由で FTP サーバーに接続しようとするとftp.exe
、正常に接続されますが、ディレクトリのリストを取得できません。エラーが発生します
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
passive
を使用する前にコマンドを使用してみてくださいls
。
FTP クライアントから、FTP サーバーがパッシブ モードをサポートしているかどうかを確認するには、ログイン後に と入力しquote PASV
ます。
以下は、パッシブ モードがオンおよびオフの vsftpd サーバーへの接続例です。
vsftpd
とpasv_enable=NO
:
# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.3.5)
Name (localhost:john): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote PASV
550 Permission denied.
ftp>
vsftpd
とpasv_enable=YES
:
# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.3.5)
Name (localhost:john): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote PASV
227 Entering Passive Mode (127,0,0,1,173,104).
ftp>
実際には、Windows ファイアウォールが接続をブロックしています。cmd.exe
これらのコマンドは、管理者からに入力する必要があります。
netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=tcp
netsh advfirewall firewall add rule name="FTP" dir=in action=allow program=%SystemRoot%\System32\ftp.exe enable=yes protocol=udp
何か問題が発生した場合は、次の方法で元に戻すことができます。
netsh advfirewall firewall delete rule name="FTP" program=%SystemRoot%\System32\ftp.exe