Recently installed VSFTPD to do FTP service, found that the system user login shell is set to/sbin/nologin, you cannot use the FTP service. Online data said that VSFTPD will be for each FTP login user to check the corresponding login shell in/etc/shells, so you need to add a line of/sbin/nologin. But I/etc/shells the document clearly has/sbin/nologin.
[Plain]View PlainCopy
- [Email protected] ~]# vsftpd-v
- Vsftpd:version 2.2.2
- [Email protected] ~]# Cat/etc/shells
- /bin/sh
- /bin/bash
- /sbin/nologin
- /bin/tcsh
- /bin/csh
However, the user set/sbin/nologin, will not login, error is as follows
[Plain]View PlainCopy
- Oops:cannot Change Directory:/home/xxx
- Oops:priv_sock_get_cmd
- The remote host shuts down the connection.
So look at the vsftpd generated by the FTP user Configuration, is also/sbin/nologin, why he can log in? (I allow anonymous users to log in), as follows
[Plain]View PlainCopy
- [Email protected] ~]# CAT/ETC/PASSWD | grep FTP
- Ftp:x:14:50:ftp User:/var/ftp/pub/:/sbin/nologin
Found the only difference is that the specified home directory is not the same, so I put the user's home directory/home/xxx replaced/var/ftp/pub/, sure enough to successfully login!
Resources:
1, http://www.linuxidc.com/Linux/2008-06/13712.htm
From for notes (Wiz)
Ways to allow FTP users to log in and disable shell logons