Change user name
Hi,
Can anyone tell me how to change my user name? Someone suggested to use the usermod command as: usermod -l login_name user_name login_name being the new user name. But, usermod : unable to lock password file is the output. |
Do you want to change your user name or your login?
|
Are you running this command as root? If you're running on Ubuntu you can do
Code:
sudo usermod -l new_name -d /home/new_name -m old_name |
Personally, I just do:
sudo -s vipw mv /home/olduser /home/newuser # the chown below is only necessary of UID or GID change chown -R newuser:newgroup /home/newuser The commands like usermod and useradd, etc. are good for scripts. Add "sudo" in front of the usermod command if you are not root, or become root with either sudo or su, and then run the command. You also need to move the users home directory (so add -the -m option to usermod) and you need to change all the file and directory permissions from the old user to the new user. [ edit: again only need to change UID/GID on files if UID/GID if you change UID/GID in passwd file. ] |
Thanks
Thanks everyone.
I am new to linux and didnt know had to log in as root. |
Quote:
|
Yes, you are right of course. I don't know what made me think UID/GID was changing here too.
|
The thing has worsened!!
I tried changing the username. But now there is another problem.
When I try to log in,a dialog says: "User's $HOME/.dmrc file is being ignored. This prevents the default session and language from being saved. Fild should be owned by the user and have 644 permissions. User's $HOME directory must be owned by user and not writable by other users. and when I hit the OK button, it says: "Your session only lasted less than 10 seconds. If you have not logged out yourself, this could mean that there is some installation problem or that you may be out of disk space. Try logging in with some of the filesafe sessions to see if you can fix this problem." I logged in in filesale GNOME but the dialogs appear as such again. What shall I do? Should I reinstall ubuntu or what? And if to reinstall it too, how? and can u explain about 644 permissions too? |
Ashhere,
well my first question would be...which method did you use to change the username? and which user are you trying to log in as? old? new? |
All times are GMT -5. The time now is 01:11 PM. |