新ftp搭建
安装前准备:
iptables -L
iptables -F
systemctl stop firewalld
systemctl disable firewalld
vim /etc/selinux/config
setsebool -P ftpd_disable_trans 1
安装步骤:
yum -y install vsftpd* pam* db4*
cd /etc/vsftpd/
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