LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing default shell for ftp only users (https://www.linuxquestions.org/questions/linux-newbie-8/changing-default-shell-for-ftp-only-users-4175475855/)

anon091 09-04-2013 08:22 AM

Changing default shell for ftp only users
 
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?

jpollard 09-04-2013 12:08 PM

Depends on the shell (and ftpd).

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.

anon091 09-04-2013 01:35 PM

Looking in /etc/shells all I have are

/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh

so I guess i'll try it with one user and see what happens, I was just curious.

jpollard 09-04-2013 04:09 PM

Quote:

Originally Posted by rjo98 (Post 5021751)
Looking in /etc/shells all I have are

/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh

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.

anon091 09-05-2013 09:34 AM

ok thanks. so does that mean every system would have a /bin/false even if it doesn't show up in /etc/shells?

jpollard 09-06-2013 05:17 AM

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").

anon091 09-06-2013 08:25 AM

oh ok, thanks for the info.


All times are GMT -5. The time now is 10:00 AM.