Linux下virtual FTP的搭建pure-ftpd
source link: https://bajie.dev/posts/20240118-pure-ftpd/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Linux下virtual FTP的搭建pure-Ftpd
用过proftpd和vs-ftpd,proftpd有巨恐怖的sftp细粒度控制,特殊场合非常好。
但是总觉得都很复杂,我们文件系统的底层是GlusterFS,在之上建立虚用户,用proftpd和vs-ftpd都感觉复杂。
所以一直在找简单的方法,最后发现了pure-ftpd,很简单!!!
首先建一个无任何登陆权的新用户,注意,uid必须在500以上,不能用系统缺省的用户ftp,后面改pure-ftpd.conf时会有说明:
useradd -u1000 -U -s/sbin/nologin -M ftpuser
安装pure-ftpd
yum -y install pure-ftpd
修改配置:
vi /etc/pure-ftpd/pure-ftpd.conf
ChrootEveryone yes
AnonymousOnly no
NoAnonymous yes
PureDB /etc/pure-ftpd/pureftpd.pdb
#PAMAuthentication yes
UnixAuthentication yes
#注意,这里就指出了最小uid,所以第一步建立用户的时候uid不能小于500,否则pure-ftpd无法认证
MinUID 500
CreateHomeDir yes
改完后,我们来增加个用户,注意语法,test是虚拟用户名,-u和-g是虚拟用户对应linux系统的系统用户,就是我们第一步建立的那个无登陆权的ftpuser,-d是home目录,这个不用建,用户第一次登陆的时候pure-ftpd会自动建立:
pure-pw useradd test -u ftpuser -g ftpuser -d /var/www/ppp
重建hash
pure-pw mkdb
重启pure-ftpd
service restart pure-ftpd
ok,搞定了,一定要注意uid的问题。其他无复杂的地方。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK