內容簡介:html
----------------------------------------------------------------------------------------------windows
安裝session
yum install vsftpd
配置文件目錄app
cd /etc/vsftpd
啓動、中止、重啓tcp
systemctl start vsftpd
systemctl stop vsftpd
systemctl restart vsftpd
vsftpd.conf ftp的核心配置文件ide
ftpusers 禁止登陸FTP的用戶列表this
chroot_list 是否容許用戶列表內的用戶訪問父目錄阿里雲
user_list 是否容許列表內的用戶登陸spa
以上將在下個部分講解3d
http://www.javashuo.com/article/p-scemzdqt-ep.html,,人家寫的比我好多了23333
1 # Allow anonymous FTP? 2 anonymous_enable=NO 3 4 # allow local users to log in. 5 local_enable=YES 6 7 # 容許寫操做 8 write_enable=YES 9 10 # Default umask for local users is 077. You may wish to change this to 022, 11 # if your users expect that (022 is used by most other ftpd's) 12 local_umask=022 13 14 15 allow_ftpd_full_access 16 17 # 匿名是否容許上傳文件 18 #anon_upload_enable=YES 19 20 # 匿名是否容許寫操做 21 #anon_mkdir_write_enable=YES 22 23 # 歡迎語設置,若是有.message這個文件 24 # messages given to remote users when they go into a certain directory. 25 dirmessage_enable=YES 26 27 # Activate logging of uploads/downloads. 28 # 上傳下載日誌記錄 29 xferlog_enable=YES 30 31 # Make sure PORT transfer connections originate from port 20 (ftp-data). 32 # 主動模式時使用20端口鏈接客戶端 33 connect_from_port_20=YES 34 35 # You may override where the log file goes if you like. The default is shown 36 # below. 37 #xferlog_file=/var/log/xferlog 38 39 # If you want, you can have your log file in standard ftpd xferlog format. 40 # Note that the default log file location is /var/log/xferlog in this case. 41 # FTP入職格式化 42 xferlog_std_format=YES 43 44 # You may change the default value for timing out an idle session. 45 # 一段時間沒有操做後斷開鏈接 46 #idle_session_timeout=600 47 48 # You may change the default value for timing out a data connection. 49 # FTP數據傳輸最大時間,超過則斷開鏈接 50 #data_connection_timeout=120 51 52 # 是否使用ASCII碼傳輸,默認使用二進制 53 #ascii_upload_enable=YES 54 #ascii_download_enable=YES 55 56 57 # 是否容許用戶訪問父目錄,默認YES 58 chroot_local_user=NO 59 # 文件限制是否開啓,若開啓後,則列表中的用戶沒法訪問父目錄 60 chroot_list_enable=YES 61 chroot_list_file=/etc/vsftpd/chroot_list 62 #iginre the writeable check 63 # 忽略寫權限檢查,若是chroot_local_user=NO,那麼主目錄不能有寫權限,這裏忽略掉它 64 allow_writeable_chroot=YES 65 66 # 是否容許列表用戶登陸 67 # 開啓文件檢查 68 #userlist_enable=YES 69 # 文件列表中的用戶是否進制登陸,YES:禁止登陸 70 #userlist_deny=YES 71 #userlist_file=/etc/vsftpd/userlist 72 73 # 監聽IPV4 74 listen=YES 75 # 開啓IPV4就關閉IPV6,好多仍是用的IPV4 76 #listen_ipv6=YES 77 78 # 應該與虛擬用戶相關吧,不清楚 79 pam_service_name=vsftpd 80 # 是否容許主機鏈接。放這吧,不清楚 81 tcp_wrappers=YES 82 83 # 開啓被動模式,windows默認開啓被動 84 pasv_enable=YES 85 # 端口開放,須要防火牆支持,若是時阿里雲則須要開放端口入方向規則 86 pasv_min_port=10010 87 pasv_max_port=10050 88 # 暴漏給客戶端外網IP,不設置默認暴漏原始IP,即內網加端口這種形式 89 pasv_address=你的外網ip
chroot_list中放置要鎖定的用戶名,一行一個
修改配置
# 不容許列表中的用戶訪問父目錄 chroot_local_user=NO # 文件限制是否開啓,若開啓後,則列表中的用戶沒法訪問父目錄 chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list #iginre the writeable check # 忽略寫權限檢查,若是chroot_local_user=NO,那麼主目錄不能有寫權限,這裏忽略掉它 allow_writeable_chroot=YES
重啓便可
方案一:在ftpusers中添加,一行一個
方案二:使用user_list
在user_list中添加禁止登錄的用戶,一行一個
修改配置文件
# 是否容許列表用戶登陸 # 開啓文件檢查 #userlist_enable=YES # 文件列表中的用戶是否進制登陸,YES:禁止登陸 #userlist_deny=YES #userlist_file=/etc/vsftpd/userlist
重啓便可