安裝前準備:linux
iptables -Lvim
iptables -Fapp
systemctl stop firewalldtcp
systemctl disable firewalldui
vim /etc/selinux/configrest
setsebool -P ftpd_disable_trans 1orm
安裝步驟:ip
yum -y install vsftpd* pam* db4*hash
cd /etc/vsftpd/it
vim vsftpd.user #添加虛擬用戶
db_load -T -t hash -f vsftpd.user vsftpd.db
useradd -d /var/ftproot -s /sbin/nologin virtual
cd /etc/pam.d/
cp -a vsftpd vsftpd.pam
vim vsftpd.pam
添加:
auth required pam_userdb.so db=/etc/vsftpd/vsftpd
account required pam_userdb.so db=/etc/vsftpd/vsftpd
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=NO
listen_ipv6=YES
pam_service_name=vsftpd.pam
userlist_enable=YES
tcp_wrappers=YES
guest_enable=YES
guest_username=virtual
user_config_dir=/etc/vsftpd/dir
allow_writeable_chroot=YES #新版必須添加不然取消目錄w權限
cd /etc/vsftpd/
mkdir dir
touch aaa
vim aaa
添加單獨虛擬用戶權限:
local_root=/share/aaa #指定虛擬用戶家目錄
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
mkdir -p /share/aaa
chown virtual.virtual /share/ -R
chmod 770 /share/ -R
systemctl restart vsftpd
添加虛擬用方法:
vim vsftpd.user #添加用戶
db_load -T -t hash -f vsftpd.user vsftpd.db
systemctl restart vsftpd