While creating a new user by SSH I accidentally tried to assign a home folder which was allready a home folder of an other user.
I tried to restore the situation but it has gotten messy.
I cannot login with the original user (it had dissapeared from /ets/passwd) and I tried manually to remove the new user from this file. After restart httpd the service didn't came up. I added the manually removed user again to the file and i could restart the httpd. Also i see the older user back in the list but i still cannot log in as this user. what can i do to fix this mess?
This topic has been locked.
4 replies Latest Post - 2010-04-01T14:37:57Z by Leom
Pinned topic problem with creatin gnew user
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-04-01T14:37:57Z at 2010-04-01T14:37:57Z by Leom
ishields 2000001P5B988 PostsACCEPTED ANSWER
Re: problem with creatin gnew user2010-04-01T11:47:20Z in response to LeomFirst thing is to back up the home directory that was affected (assuming you don't have a backup from immediately before the problem).
I'm not certain, but I think the only way you could have deleted the original user from /etc/password using normal user updating utilities would have been to assign the same name or user number to the new user. I believe the adduser command should have failed with a warning if you attempted to use an existing uid.
Without knowing what commands you used to cause the problems, it's hard to know what's best. I would probably start by figuring out what uid the original user had and what groups the user was a member of. Then try to delete both users, including home directories (make sure you have that backup of the original home). Next try to recreate the original user with the original uid and group memberships and a new home directory. Make sure user can log in. Make sure that the ownerships in the backed up directory match those of the new home directory. If so, try restoring the home from your backup. If all is well, try recreating the new user but don't make the original mistake again.
Re: problem with creatin gnew user2010-04-01T11:55:11Z in response to LeomThanks for your input! I used adduser username -d /home/homefolder and yes i got warnings, but i think it executed stil at leased the half of what i tried to do. ofcourse it is not wise to have created a user with a home folder which was not the username.
I will try what you propose, i hope it works!
sdenham 100000263Q3 PostsACCEPTED ANSWER
Re: problem with creatin gnew user2010-04-01T14:23:49Z in response to LeomWhat Ian said, plus remember to look at /etc/shadow and keep it in sync with /etc/passwd. I have seen cases where a user exists in one but not the other and the standard Linux user management tools don't deal with that very well.