LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-27-2012, 04:59 AM   #1
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Rep: Reputation: Disabled
Deleted default system users


I read a security article that mentioned to remove all default users, so I went ahead and removed these users:

bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0perator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin

Is there anything wrong with doing that?
I saved my passwd and shadow files but I guess I would have to add the users back in somehow if I needed. How would I do that?
I dont seem to have an issue so I'm not sure if these users are really needed but then I read that you shouldn't remove system users.

Which one is it?

Thanks,
Shawn
 
Old 06-27-2012, 07:32 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Member Response

Hi,

Please share the article link?
 
Old 06-27-2012, 07:51 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by rootaccess View Post
Is there anything wrong with doing that?
Yes. Those accounts exist for a reason, they do not have home directories and they do not have passwords (you cannot log in to those accounts from a login prompt). They are needed for a number of system operations.
Quote:
I saved my passwd and shadow files but I guess I would have to add the users back in somehow if I needed. How would I do that?
If you saved the /etc/passwd and /etc/shadow files before removing the accounts, you should copy the saved files back to where they belong; you will need to be logged in as root (or su - or sudo):
Code:
cp passwd.backup /etc/passwd
cp shadow.backup /etc/shadow
Then execute the following
Code:
cd /etc/
chown root.root passwd shadow
chmod 644 passwd
chmod 600 shadow
Quote:
I dont seem to have an issue so I'm not sure if these users are really needed but then I read that you shouldn't remove system users.
[
Yes, they're needed. Yes you should not mess with them. Yes you will have an issue -- as in real problems -- if you don't put 'em back the way they're supposed to be.

Hope this helps some.
 
Old 06-27-2012, 12:17 PM   #4
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tronayne View Post
Yes. Those accounts exist for a reason, they do not have home directories and they do not have passwords (you cannot log in to those accounts from a login prompt). They are needed for a number of system operations.

If you saved the /etc/passwd and /etc/shadow files before removing the accounts, you should copy the saved files back to where they belong; you will need to be logged in as root (or su - or sudo):
Code:
cp passwd.backup /etc/passwd
cp shadow.backup /etc/shadow
Then execute the following
Code:
cd /etc/
chown root.root passwd shadow
chmod 644 passwd
chmod 600 shadow
Yes, they're needed. Yes you should not mess with them. Yes you will have an issue -- as in real problems -- if you don't put 'em back the way they're supposed to be.

Hope this helps some.
Thanks. I had a feeling I could just copy over the passwd and shadow files, thats why I made the backup. I just wanted to make sure I didn't have to actually create the users without home directories and passwords.

The article is here
http://www.faqs.org/docs/gazette/tips.html

I'm aware its a bit old but still found it a bit useful

Last edited by rootaccess; 06-27-2012 at 12:27 PM.
 
Old 06-27-2012, 12:23 PM   #5
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Original Poster
Rep: Reputation: Disabled
I also wanted to mention that although my passwd file was already set to 644, my shadow file was initially set to just 000. Literally no permissions. I'm running CentOS

And on another note, I appended the following line in /etc/inittab to prompt for a login and password for single user mode but it never seemed to work.


~~:S:wait:/sbin/sulogin

Last edited by rootaccess; 06-27-2012 at 12:25 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ProFTPd is anonymous-only by default... How to add system users?!? Dinobot Linux - Server 9 12-20-2009 05:05 PM
Script to add a secondary group to all users except system default users Tekken Linux - Server 5 06-29-2009 04:02 PM
default system users (like sshd , nobody, etc) supradrvr Slackware 2 12-22-2006 08:28 AM
How to set a Gnome theme as default for all users and future users ? MDesigner Linux - Newbie 1 06-28-2004 11:12 AM
Deleted the /root/.bash_profile, looking for default bparke Linux - Newbie 4 11-19-2003 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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