yum安装ftp服务器
1、安装vsftp,本文采用yum安装:
#yum install vsftpd
2、安装后运行:
# service vsftpd restart
Shutting downvsftpd: [ OK ]
Starting vsftpd forvsftpd: [ OK ]
3、新增加系统用户ftptest:
#useradd -d /var/www -s /sbin/nologin gd_user1 //增加新用户ftptest不让在本机登陆
#chown -R gd_user1/var/www //更改新增目录的权限,只允许ftptest访问此目录;
#chmod 777 -R /var/www
# passwd gd_user1 //为用户设置密码;
Changing password for user gd_user1.
New UNIX password:
BAD PASSWORD: it does not contain enough DIFFERENTcharacters
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
5、修改vsftpd.conf 禁止匿名帐号登陆及允许自建帐号登陆:
#vi /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
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
4、修改/etc/vsftpd/chroot_list 添加gd_user1帐号允许该帐号登陆FTP服务器
vi /etc/vsftpd/chroot_list
输入gd_user1
5、在linux Shell 命令模式下
#setsebool ftpd_disable_trans 1 // 关闭掉Selinux 对ftp服务的保护;
#vi /etc/selinux/config
SELINUX=disabled //将此处设置为Disable
# SELINUXTYPE= type of policy in use. Possible valuesare:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection.
SELINUXTYPE=targeted
重启服务
# service vsftpd restart
Shutting downvsftpd: [ OK ]
Starting vsftpd forvsftpd: [ OK ]
记得关闭火墙