基於虛擬用戶的ftp-vsftp服務器

FTP模式: 
ftp主動模式(port):21(驗證,握手),20(數據傳輸)
ftp被動模式(pasv):21(驗證,握手),1024-65535(數據傳輸),一般的FTP服務器都採用此模式作爲默認模式

FTP的客戶端:
 命令行客戶端:ftp/lftp(可以兼容shell的快捷操作)
 圖形工具:       IE/firefox/cute-ftp/filezilla(win/lin)/gftp
 gftp:yum -y install gftp
 
 opensource(free) GPL/LGPL/BSD

1.安裝
# yum -y install vsftpd

vim /root/ftp/.txt

user1
passwduser1
user2
passwduser2

 

2. 轉換成數據格式

db_load -T -t hash -f /root/ftp.txt /etc/vsftpd/vsftpd_login.db
chmod 600 /etc/vsftpd/vsftpd_login.db

3.增加模塊

vim /etc/pam.d/ftp
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login crypt=hash
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login crypt=hash

4.編輯配置文件

vim /etc/vsftpd/vsftpd.conf
anonymous_enable=no
local_enable=YES
#write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=ftp
userlist_enable=YES
userlist_deny=YES
tcp_wrappers=YES
guest_enable=YES
guest_username=www
chroot_list_file=/etc/vsftpd/chroot_list
chroot_local_user=yes
user_config_dir=/etc/vsftpd/ew
max_clients=300
max_per_ip=10
#anon_world_readable_only=NO
#pasv_min_port=30000
#pasv_max_port=30999
 

5.給不同用戶不同的權限,這裏就弄一個樣例

vim /etc/vsftpd/ew/user1
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
write_enable=YES
virtual_use_local_privs=YES
local_root=/home/www/555.com

7.最後驗證

service vsftpd restart
chkconfig vsftpd on

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章