A Ubuntu server has been installed recently and a dedicated ftp user needs to be created. To ensure security, ftp users are prohibited from logging on to the shell. According to freebsd's operating habits, I set the ftp user's shell to/usr/bin/nologin. Unexpectedly, the user could not log on to ftp. After changing the shell to/bin/bash, the ftp could log on again. Login cannot be disabled. There are many solutions, including disabling port 22, setting/etc/hosts. deny, or/etc/h.
A Ubuntu server has been installed recently and a dedicated ftp user needs to be created. To ensure security, ftp users are prohibited from logging on to the shell. According to freebsd's operating habits, I set the ftp user's shell to/usr/bin/nologin. Unexpectedly, the user could not log on to ftp. After changing the shell to/bin/bash, the ftp could log on again. Login cannot be disabled. There are many solutions, including disabling port 22, setting/etc/hosts. deny or/etc/hosts. allow. However, these methods have many limitations. The final reason is that/usr/bin/nologin is not in the/etc/shells list. During ftp login, check whether the user's shell settings are correct, I forcibly changed the shell to a non-existent/usr/bin/nologin, and an error occurred.
Solution: Modify/etc/shells and add a line/usr/bin/nologin to the shell list. Change the ftp user's shell to/usr/bin/nologin.