LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-08-2009, 12:09 PM   #1
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Rep: Reputation: 30
Which accounts listed in the /etc/passwd file should have a login shell ?


Hi,
I was just looking at my /etc/passwd file and noticed that many of the "non-user" accounts have been assigned login shells e.g.

Code:
$ cat /etc/passwd

------ snipped -----
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
------------------snipped---------
Would it be wise to change "/bin/sh" to "/bin/false" ? Could someone kindly explain why these accounts have been allocated login shells ?

Thanks
C
 
Old 10-08-2009, 01:48 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quite simply, accounts that you want to have interactive shell access (probably root and unprivileged shell users) should have a shell assigned in /etc/passwd. Most service accounts should not have one (there are exceptions, like Tomcat).

What is the system you're looking at, and who maintains it?
 
Old 10-08-2009, 02:40 PM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
This doesn't look right to me. If it were my system, I'd run chkrootkit to check for rootkits (http://www.chkrootkit.org/), and if that passed look at the distribution's bugs list or online support for any known issues.

The easiest way to tell exactly which version and OS you're using is usually to run the following in a terminal:
Code:
cat /etc/*release
 
Old 10-09-2009, 04:19 AM   #4
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Original Poster
Rep: Reputation: 30
Thanks gents. The machine is a Ubuntu 8.10 box that is part of a small home network. I only have 5 ports open : 22, 5900, 613, privoxy + tor. The firewall is set to drop everything except access to port 22, 5900 from an IP on my internal LAN.
My hosts.deny file contains the line sshd :ALL and hosts.allow has the lines:
sshd : ***.***.***.*** (a)
sshd : xxx.xxx.xxx.xxx (b)


where (a) and (b) are the only two IPs that are allowed to access the ssh server.



C

*** Update ****

chkrootkit showed no infections
rkhunter showed nothing suspicious

Last edited by uncle-c; 10-09-2009 at 05:49 AM. Reason: ran chkrootkit + rkhunter
 
Old 10-19-2009, 06:31 PM   #5
peridot121
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Rep: Reputation: 2
This is normal for an ubuntu system. It installs lots of things by default into /etc/passwd that you might not even need, like the games user on the server edition...

After breaking some things once by substituting /bin/false for some accounts, I decided to just let it be. I'm sure some of them can be turned into /bin/false, though. Here's what I've got on an ubuntu 9.04 server install with no gui (minus my user login):

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13roxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:102::/home/syslog:/bin/false
klog:x:102:103::/home/klog:/bin/false
mysql:x:103:105:MySQL Server,,,:/var/lib/mysql:/bin/false
sshd:x:105:65534::/var/run/sshd:/usr/sbin/nologin
messagebus:x:106:111::/var/run/dbus:/bin/false
postfix:x:104:115::/var/spool/postfix:/bin/false
logcheck:x:108:118:logcheck system account,,,:/var/lib/logcheck:/bin/false
ntp:x:109:119::/home/ntp:/bin/false
 
  


Reply



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
/etc/passwd does users 'man' and 'nobody' really need a login shell? darin722 Linux - Security 3 02-21-2009 06:15 PM
Shell script to list all users in /etc/passwd file milestone Programming 6 09-15-2007 12:57 PM
custom Login shell in /etc/passwd pypieuvre Linux - Software 1 02-16-2006 07:19 AM
Is shell login/passwd localizable? ricky_ds Linux - Software 2 06-29-2005 02:43 AM
changed the login shell in /etc/passwd to the wrong path infamous41md Solaris / OpenSolaris 3 07-03-2004 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:20 AM.

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