LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-04-2013, 08:22 AM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
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?
 
Old 09-04-2013, 12:08 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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.
 
Old 09-04-2013, 01:35 PM   #3
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
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.
 
Old 09-04-2013, 04:09 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by rjo98 View Post
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.
 
Old 09-05-2013, 09:34 AM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
ok thanks. so does that mean every system would have a /bin/false even if it doesn't show up in /etc/shells?
 
Old 09-06-2013, 05:17 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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").
 
1 members found this post helpful.
Old 09-06-2013, 08:25 AM   #7
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
oh ok, thanks for the info.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Users Default Env variables at creation jmc1987 Linux - General 5 12-09-2014 07:55 PM
FTP - changing default directory linuxguy08 Linux - Server 10 07-30-2009 12:37 AM
Changing the Default Shell. maxvonseibold Linux - General 2 08-20-2007 10:27 AM
changing my default shell after login? Quartzophobia Linux - General 1 02-11-2004 11:36 AM
Changing default current directory to / when ftp ckit Linux - Newbie 1 01-27-2004 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration