LinuxQuestions.org
Review your favorite Linux distribution.
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


Closed Thread
  Search this Thread
Old 06-27-2006, 11:13 AM   #1
hey hey
LQ Newbie
 
Registered: Jun 2006
Posts: 9

Rep: Reputation: 0
deleted system accounts


Sorry for the repost, I posted this in general but didn't see there was a newbie section.

I just finished installing Kubuntu and configuring it all, it took me more than a whole day. Now I know this is retarded, but I thought that for the good of my PC's security, I should only have two accounts: root and my own account. So i userdel'd all the other accounts I found in /etc/passwd, now it won't connect to the internet and it certainly is due to this. Is there any way I could restore all the system accounts I deleted??
 
Old 06-27-2006, 12:18 PM   #2
bigjohn
Senior Member
 
Registered: Jun 2002
Location: UK .
Distribution: *buntu (usually Kubuntu)
Posts: 2,682
Blog Entries: 9

Rep: Reputation: 45
Quote:
Originally Posted by hey hey
Sorry for the repost, I posted this in general but didn't see there was a newbie section.

I just finished installing Kubuntu and configuring it all, it took me more than a whole day. Now I know this is retarded, but I thought that for the good of my PC's security, I should only have two accounts: root and my own account. So i userdel'd all the other accounts I found in /etc/passwd, now it won't connect to the internet and it certainly is due to this. Is there any way I could restore all the system accounts I deleted??
Isn't it just easier to run the install again ??
 
Old 06-27-2006, 12:24 PM   #3
hey hey
LQ Newbie
 
Registered: Jun 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bigjohn
Isn't it just easier to run the install again ??
After configuring the system for hours I'm hoping there is a better solution, isn't there..?
 
Old 06-27-2006, 12:45 PM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
I have one solution that may work for you. Boot up the Kubuntu CD as a Live CD.

1) Mount your drive read-write (should be something like /dev/hda1 and it should be mounted in /mnt/hda1)

2) Navigate on your hard drive (/dev/hda1) to find the hard drive's /etc/passwd (/mnt/hda1/etc/passwd) and open it (it should contain only the lines you didn't delete). You might have to be root.

3) open the Live CD's /etc/passwd (Navigate with Konqueror to the / directory then /etc). This file should have all of the system services and stuff that were present on your original install, but might be missing some of the ones you setup after that.

4) Copy the contents from /etc/passwd to /dev/hda1/etc/passwd but be careful not to overwrite the file or delete the lines you left (which should be your user).

5) Save the file /dev/hda1/etc/passwd and reboot into your install. You should now have all the other users back at least from the base install.
If you installed other programs, like apache2, you'll have to reinstall them sudo aptitude reinstall apache2. Just be sure to save the config files you modified (copy them to to something like file.conf.new or something like that). That way you'll be sure they don't over write your changes and if it does, you can just copy the file back.

Now, you've learned a couple of important things here. The first is that you need to read a bit more about how linux works. You'll find that programs and services create users for themselves in linux that give them restricted permissions on what they can do. For example, ssh creates a user "ssh" so it has restricted permissions. On windows and ssh server will run as Adminstrator or System and have full access to everything. So a security flaw will compromise your system. On linux, the system may be partially compromised, but at least the hacker won't have full root access.

The second thing you should have learned from this is to always make a copy of system files before you start mucking with them. sudo cp filename.conf filename.conf.orig is your best friend when you screwed up a file. I even do it for simple files in my /home folder (like .bash_profile and .bashrc).

Third, this might be one case where reinstallation isn't a bad thing. I know it took you a whole day to setup this time how you wanted it, but it's possible that you could do it a lot faster the 2nd time around. If this was your first ever linux install, reinstalling might even be fun. So consider that if you think this is too difficult.

Anyway, welcome to Linux! With great power comes great responsibility. I'd take some time once you're up and running again to read some of the newbie docs around the web. If you search around these forums, you'll find some other helpful links. But here's a few:

http://linux-newbie.sunsite.dk/
http://www.tuxfiles.org/

Good luck and hope this helps! Come back if you need more help.

Last edited by pljvaldez; 06-27-2006 at 12:46 PM.
 
Old 06-27-2006, 01:02 PM   #5
hey hey
LQ Newbie
 
Registered: Jun 2006
Posts: 9

Original Poster
Rep: Reputation: 0
thanks for the replies! I'm going to reinstall...
 
Old 06-27-2006, 01:35 PM   #6
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
theres always a "passwd-" you can restore it if you made some wrong changes or your passwd got deleted.
 
Old 06-27-2006, 02:00 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

Here's the original:
http://www.linuxquestions.org/questi...d.php?t=458771

And here the latest one:
http://www.linuxquestions.org/questi...50#post2310050
 
  


Closed Thread


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
PHP web authentication using system accounts jineshkj Programming 1 04-30-2006 11:53 PM
List all user accounts on a system? bullium Linux - General 2 04-18-2005 11:07 AM
SquirrelMail authenticate with system accounts paul_mat Slackware 2 03-16-2005 08:54 AM
do inactive accounts get deleted? Berhanie LQ Suggestions & Feedback 5 01-02-2005 11:12 PM
copy user accounts to other linux system pangfai Linux - Security 2 08-29-2003 05:50 AM


All times are GMT -5. The time now is 10:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration