recovering deleted user

Asked by ruffrohit

the solution to this may be quite simple, however, i dont want to take any chances with my new system. i'm quite new to ubuntu and have much to learn!

here is the problem:
today, i created a new user by the name "rohit" on my computer, then, i immediately deleted the user. I realised that the "rohit" home folder has not been deleted (ubuntu does that for security reasons). I now wish to create a new user by the name "rohit" again. however, after creating the user account, it just doesn't appear on the user list.

could you tell me how i can create a new user by the same name. could it be possible that if i just change the home folder name (which automatically becomes home/rohit) to something else, it will work out?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Allen Chemist
Solved:
Last query:
Last reply:
Revision history for this message
Allen Chemist (alchemist) said :
#1

Hi Ruffrohit,

First, let me say welcome to the wonderful world of Linux :)

This 'rohit' user that you created and then erased, is there any reason to keep the folder around? The reason it's not erased when you remove the user, is because that is where all of that user's files are stored. At least in business, when a user leaves a department, usually someone takes over and picks up where they left off. Not erasing the home folder allows the admin later to copy them/move them to the new people, or delegate them to other people. If you simply created the user, then erased them, there won't be any important files within the home folder.

I tried unsuccessfully on my system to re-create your exact problem. Which user list are you talking about, the one on the login screen or the one in the "User administration" screen where you added them?

Revision history for this message
ruffrohit (ruffrohit) said :
#2

hey! thank you for replying!
well, both screens actually, when i recreate the user in the "user administration" screen, after clicking ok, the window closes. however, the user name doesn't appear on the user list!
also, it doesn't even appear on the log in screen.

would it be possible that if i re-create this "rohit" user and instead of keeping the home folder as "/home/rohit" (as it was for the "rohit" user i deleted) i keep it as, say, "/home/Rohit" would that solve the problem??
The reason i'm asking you is because i dont really want to mess up my system any more by taking any wrong steps!

PS: sorry for replying so late, the launchpad server was down yesterday.

Revision history for this message
Allen Chemist (alchemist) said :
#3

Hey,

No worries on the late reply, that's what I really enjoy about launchpad -- I can see the status of everything I'm subscribed to easily, plus the entire history!

When giving my answer above, I actually created a rohit on my machine, deleted it, then re-created it and everything worked for me. The fact that you are having a problem might signify a bigger problem.

As a short answer, creating the home folder as "Rohit" won't hurt anything (but may confuse you in the future). Also, it may not fix the problem, because if the home folder was the problem I would expect the user to be 'created', but when you try and log in, it would log you back out with an error saying it can't access your home folder (because it would belong to the previous rohit who was deleted!)

Can you do the following, and copy and paste back what it says:
Click Applications -> Accessories -> Terminal
type this in:
sudo adduser rohit

It will ask you a series of questions -- don't worry about the stuff like Full Name, Room Number, Phone Number, etc.

Revision history for this message
ruffrohit (ruffrohit) said :
#4

hey,
i did as you said. opened the terminal and typed in the command. it asked me for my password, as soon as i entered it, i got this reply:

adduser: The group `rohit' already exists.

it didnt ask em any futher questions or anything.

Revision history for this message
ruffrohit (ruffrohit) said :
#5

also, out of curiosity, i then went to system-> administration-> users and groups
i clicked on manage groups. i saw some groups which i guess ubuntu creates by default, and i also saw a "rohit" user group.
now, isn't this weird since i have never created a "rohit" group???

Revision history for this message
Best Allen Chemist (alchemist) said :
#6

When you create a new user by default, it creates a group with the same name -- rather annoying default behaviour (but most distros do it)

My guess is that is your error. On my other machine, I am able to re-create your exact problem. Add a user test, remove the user, add them back, and they don't get added. The 'test' group is also left behind.

So armed with this information, either remove the rohit group from the list of groups, or one last kick at the terminal:
sudo groupdel rohit

That will remove that old group, which has caused so much trouble. Now you *should* be able to add the rohit user back in (what a headache, eh?!)

This looks like it is an already-reported bug, so it looks like someone is working on it:
https://bugs.launchpad.net/ubuntu/+source/gnome-system-tools/+bug/66051

Revision history for this message
ruffrohit (ruffrohit) said :
#7

yes sir!! :D
that did it! well, quite a headache indeed. but its nice to know someone is working on it! I'm pretty sure that by the time of Hardy, ubuntu will get rid of most bugs..

again, thanks a lot for the help!

Revision history for this message
ruffrohit (ruffrohit) said :
#8

Thanks Allen Chemist, that solved my question.

Revision history for this message
Ellen Earhart (eearhart) said :
#9

I have a similar problem. Your solution works for adding and deleting users.

However, what I want to do is be able to delete the USER FILES as well as the user. I have a classroom of 20 computers, and I need to go through and set them back up at the beginning of the year. I want a "clean slate" with no user files cluttering up the computers. Then I can add users as needed for each class/group. But how to get rid of the old user files... to clean up and prep for the new year?