LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   is there a way to rename a user? (https://www.linuxquestions.org/questions/linux-general-1/is-there-a-way-to-rename-a-user-361849/)

Pear-i 09-09-2005 03:29 PM

is there a way to rename a user?
 
hey there -- just wondering if there's a way to rename a user -- that is change the user name.

>i was thinking of making a completely new account but i've already setup the settings for the first account so just need away to use a different username and still retain all the settings

thanks

puffinman 09-09-2005 03:40 PM

Try the -l (that's dash ell) option with the usermod command. See man usermod.

oneandoneis2 09-09-2005 03:57 PM

Failing that, changing the user's name in /etc/password, /etc/shadow and /etc/group & renaming the /home directory would probably work. . .

imitheos 09-09-2005 04:16 PM

Quote:

Originally posted by oneandoneis2
Failing that, changing the user's name in /etc/password, /etc/shadow and /etc/group & renaming the /home directory would probably work. . .
Yes, that would work. It's the manual way of doing it.
But, there are some other things you must do also. (e.g /var/mail/login_name etc)

that is why usermod exists :P

Let's suppose the username is foo (/home/foo) and we want to make it bar (/home/bar)

usermod -d /home/bar -m -l bar foo

-d takes the new home directory
-m moves the stuff from the old home to the new
-l takes the new login_name

for more info run "man usermod"

Depending on the distribution you use, there will also be from 1 to 100 gui programs that do user management.


All times are GMT -5. The time now is 08:47 AM.