centos7上建立vsftp服務,構建圖片伺服器各種異常
阿新 • • 發佈:2018-12-22
埠開啟方式:
centos7下跟舊版本有些不同:
firewall-cmd –zone=public –add-port=20/tcp –permanent
firewall-cmd –zone=public –add-port=21/tcp –permanent
firewall-cmd –zone=public –add-port=22/tcp –permanent
firewall-cmd –zone=public –add-port=30000-35000/tcp –permanent
重啟防火牆:
systemctl restart firewalld.service
在Java程式碼中構建ftp上傳中可增加:
ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
檢視各種上傳狀態:
CWD /home/ftpuser/ftp/images
250 Directory successfully changed.
TYPE
200 Switching to Binary mode.
PORT 192,168,0,7,22,31
200 PORT command successful. Consider using PASV.
STOR 3.jpg
425 Failed to> establish connection.
以上錯誤需要在上傳設定時:ftp.enterLocalPassiveMode();
Java FTP 報錯 :Permission denied: recv failed
關閉本機防火牆解決
FTP上傳成功返回:553 Could not create file
上傳者使用者對目標資料夾的許可權設定