Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Reviewing an /etc/passwd file on an ftp server, there are quite a few accounts that are used for ftp only access, yet their shell in passwd shows as /bin/bash rather than /sbin/nologin.
If they are only using the accounts to FTP to the server, changing the shell shouldn't cause any issues even though they've been using it like this for a while, right?
nologin is used to disable logins, I believe ftp will also respect that, but it depends on the ftp service. At least one ftpd server doesn't care what the shell is, as long as it is in the /etc/shells file.
One entry that shouldn't cause a problem is changing the users shell to /bin/true (or false for that matter). You do need to add whichever one to the /etc/shells list so that it is considered a valid shell.
What using /bin/true (or /bin/false) does is to just exit when the user tries to login with a shell connection, so even if the user gets logged in, they get logged out immediately.
Try using /sbin/nologin and see if it works for you. If it does (and doesn't block ftp logins) go with it.
so I guess i'll try it with one user and see what happens, I was just curious.
The only difference I can find between /sbin/nologin and /bin/false, is that nologin writes a message to the user "This account is currently not available", and can display the contents of the file /etc/nologin.txt.
The /etc/nologin.txt should disable ftp - it should have the reason logins are being disabled, but can be empty. I've used it to tell users the system is unavailable due to maintenance, and tell them when the system is scheduled to return to service. It is normally created automatically during shutdown so users will stop trying to login at the beginning of a timed shutdown.
Yes. /bin/false is a utility that is sometimes built into shells, but is also provided externally. All the true/false utilities do is set the exit status to 0/1 (and yes, this is not directly obvious: 0 as an exit status is a "successful exit" and 1 as an exit status is an "error exit").
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.