ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ftp服务搭建

ftp服务搭建

原创 Linux操作系统 作者:正月十七 时间:2017-08-21 16:14:35 0 删除 编辑
1.rpm包安装
# yum install -y ftp
# yum install -y vsftpd
# yum install db4 db4-utils (Linux6)
# yum install -y libdb-utils (Linux7)


2.编辑主配置文件
# cd /etc/vsftpd/
# vi vsftpd.conf #添加如下项目
##################
anonymous_enable=NO
local_enable=YES
chroot_list_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
pam_service_name=vsftpd
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd/vconf


pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40080
pasv_promiscuous=YES
allow_writeable_chroot=YES(Linux7)
#########################
创建chroot_list文件
touch /etc/vsftpd/chroot_list


3.编辑FTP用户密码文件  (每次添加FTP用户3,4,5,6,10步骤都要做)
# mkdir vconf
# vi vusers
############FTP用户密码文件,一行用户名一行密码,类似如下:
ftptest      
ftptest
############


4.生成FTP用户密码db库文件
# db_load -T -t hash -f /etc/vsftpd/vusers /etc/vsftpd/vusers.db


5.配置FTP用户个人配置文件
cd vconf
vi ftptest(必须同上面密码文件的用户名)
###############
local_root=/FTP/ftptest(ftp用户的根目录)
write_enable=YES
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
#################


6.创建FTP用户
mkdir -p /FTP/ftptest
chown ftptest.ftptest /FTP/ftptest
chmod 777 /FTP/ftptest


useradd -d /FTP/ftptest -s /sbin/nologin ftptest
passwd ftptest


7.vi /etc/pam.d/vsftpd添加如下行:
auth required pam_userdb.so db=/etc/vsftpd/vusers
account required pam_userdb.so db=/etc/vsftpd/vusers


8.关闭防火墙
Linux7:
systemctl stop firewalld 
systemctl disable firewalld


Linux6:
service iptables stop
chkconfig iptables off


9.关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing  
SELINUX=disabled 


临时关闭:
setenforce 0 


10.启动vsftpd服务
Linux7
systemctl restart vsftpd
systemctl enable vsftpd


Linux6
service vsftpd restart
chkconfig vsftpd on


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30592920/viewspace-2143891/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle dg安装
请登录后发表评论 登录
全部评论

注册时间:2015-11-27

  • 博文量
    21
  • 访问量
    19449