LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-21-2012, 06:59 AM   #1
jeffersonmvg
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Rep: Reputation: Disabled
Can I use /sbin/nologin to prevent a user to have access to interactive shell?


Can I use /sbin/nologin to prevent a user to have access to interactive shell?

Thanks in advance
 
Old 12-21-2012, 07:59 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,298

Rep: Reputation: Disabled
According to man nologin, that's the entire purpose of the program. To prevent logins, that is.
 
Old 12-21-2012, 08:06 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
You can create /etc/nologin to restrict users from login into the system. Only root login will be allowed then.

--- Adding -------

Hi @jeffersonmvg,
Perhaps I didn't read your question properly & I thought you want to restrict users from login into system.
Anyway, you can use /sbin/nologin shell to restrict user, but check whether this is available in your system or not.
If it's not available, then you can add /bin/false as shell for the user whom you do not wish to give login access.
Code:
usermod -s /sbin/nologin username
OR
usermod -s /bin/false username
In addition to /bin/false, add /dev/null in place of home directory in /etc/passwd. (Note: Take backup of /etc/passwd if you manually edit it). New /etc/passwd file entry for that user will look like this:
Code:
username:x:123:123:Sample:/dev/null:/bin/false

Last edited by shivaa; 12-21-2012 at 12:06 PM. Reason: Added info
 
2 members found this post helpful.
Old 01-02-2013, 04:37 AM   #4
jeffersonmvg
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you shivaa
 
  


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
How to change the root shell /sbin/nologin to /bin/bash by login as user sunrised24 Linux - Server 9 02-05-2012 06:12 AM
[SOLVED] Ubuntu 9.04, chpasswd & /usr/sbin/nologin Feetloaf Ubuntu 4 07-15-2010 07:20 PM
/bin/false vs /sbin/nologin - difference? ziggie216 Linux - General 1 12-22-2005 02:59 AM
sendmail adduser sbin/nologin using php mhatre kedar Linux - Networking 0 04-18-2005 01:12 AM
/sbin/nologin tyccea Red Hat 2 10-22-2003 07:56 AM

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

All times are GMT -5. The time now is 09:44 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