Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2010-04-01T14:37:57Z by Leom
Leom
Leom
3 Posts
ACCEPTED ANSWER

Pinned topic problem with creatin gnew user

‏2010-04-01T10:53:52Z |
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?
Updated on 2010-04-01T14:37:57Z at 2010-04-01T14:37:57Z by Leom
  • ishields
    ishields
    988 Posts
    ACCEPTED ANSWER

    Re: problem with creatin gnew user

    ‏2010-04-01T11:47:20Z  in response to Leom
    First 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.

    Ian Shields
  • Leom
    Leom
    3 Posts
    ACCEPTED ANSWER

    Re: problem with creatin gnew user

    ‏2010-04-01T11:55:11Z  in response to Leom
    Thanks 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
    sdenham
    3 Posts
    ACCEPTED ANSWER

    Re: problem with creatin gnew user

    ‏2010-04-01T14:23:49Z  in response to Leom
    What 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.
  • Leom
    Leom
    3 Posts
    ACCEPTED ANSWER

    Re: problem with creatin gnew user

    ‏2010-04-01T14:37:57Z  in response to Leom
    Thanks, more very handy information.