LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   change username and password (https://www.linuxquestions.org/questions/linux-newbie-8/change-username-and-password-4175491827/)

CurtisMills 01-19-2014 03:28 PM

change username and password
 
I have Linux Mint 16 on my computer. How do I change the username and password?

btmiller 01-19-2014 04:28 PM

Changing the password is easy; just open up a command prompt while logged in and type the "passwd" command (no quotes). You will be prompted for the current password and then given an opportunity to change it.

Changing the user name is somewhat hardwaer. You have to find the correct entry in /etc/passwd and /etc/shadow and change the name there. You also need to edit /etc/group and change all references from the old name to the new name. Note: if you mess this up, you will probably lock yourself out of the system, so before you do this, it's a good idea to create and "rescue" account that su or sudo to root in case something goes wrong. Also, I'd recommend making back-up copies of /etc/passwd, /etc/shadow, and /etc/group.

GVrooman 01-19-2014 05:21 PM

Why not just create a new user account with a new password? Then when you are logged on under the new account you can delete the old one. Or maybe I am missing something here.

shane25119 01-19-2014 05:37 PM

A little Googling shows changing the username should work just the same as the password change:

http://www.ehow.com/how_8143052_chan...x-account.html

Given Mint is pretty newbie friendly, I have to imagine the settings manager also has a way to do this (well, the XFCE version doesn't- but maybe GNOME/KDE do).

astrogeek 01-19-2014 05:54 PM

Quote:

Originally Posted by shane25119 (Post 5101084)
A little Googling shows changing the username should work just the same as the password change:

http://www.ehow.com/how_8143052_chan...x-account.html

Given Mint is pretty newbie friendly, I have to imagine the settings manager also has a way to do this (well, the XFCE version doesn't- but maybe GNOME/KDE do).

See man usermod...

Quote:

-l login_name
The name of the user will be changed from login to login_name.
Nothing else is changed. In particular, the user's home directory name
should probably be changed to reflect the new login name.
In general, there are quite a few additional things that should/must be changed when a user name is changed, including any groups, file paths, keys, etc. derived from the original name and anything that references the name instead of the UID.

It depends somewhat on how active the original user has been and how long the account has existed - the longer and more active, the more likely unexpected things will break downstream.


All times are GMT -5. The time now is 06:15 AM.