寻觅生命中的那一片浅草......

vsftpd与/bin/false、/sbin/nologin

今天在服务器上配置nginx+php+mysql,配置好,就差ftp管理文件了,
yum -y install vsftpd
useradd -g www -d /data0/htdocs/www -s /bin/false -M www
然后登录时一直报530 Login incorrect错误,查了好多资料都不行,开始怀疑是-d /data0/htdocs/www问题,去掉,用
useradd -g www -s /bin/false -M www


依然不行
怀疑是-s /bin/false,用
useradd -g www -d /data0/htdocs/www -M www
就可以登录了,网上查了/bin/false和/sbin/nologin的差别,发现如果想要用false在禁止login的同时允许ftp,则必须在/etc/shells里增加一行/bin/false,
[root@nginx conf]# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh

发现有定义/sbin/nologin,将增加用户的命令修改为
useradd -g www -d /data0/htdocs/www -s /sbin/nologin -M www
这样添加的用户就可以登录FTP了。

如果要限制用户在主目录,则需作如下设置:
1、修改/etc/vsftpd/vsftpd.conf
将底下三行
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
改为
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
2、编辑文件: /etc/vsftpd/chroot_list
内容为ftp用户名,每个用户占一行,如:
www
john
3、重新启动vsftpd
[root@nginx conf]# /etc/init.d/vsftpd restart

尚无评论

发表评论

2024年三月
« 5月    
 123
45678910
11121314151617
18192021222324
25262728293031