Link to home
Start Free TrialLog in
Avatar of newexhsh
newexhsh

asked on

change user name

hello...
Can i know how to change user name in linux?
Any command can change user name?
Also, if i change the user name, their mail and ftp account also will be changed?
thx everyone to reply
Avatar of jlevie
jlevie

A change to a user name requires at least:

1) Edit of /etc/passwd, /etc/shadow, /etc/group, & /etc/gshadow

2) Rename /home/old-username /home/new-username

3) Rename of /var/spool/mail/old-username /var/spool/mail/new-username

Other changes may to aliases, virtusertable, Samba, etc may be required.

And yes, the mail and ftp account will typically change when you change the user name.
You can do this quite easily with the usermod command. The usermod command will alter all the system files which need to be changed. Have a look at "man usermode" from a command prompt (without the quotes).
Avatar of newexhsh

ASKER

Can you give me an example because i am new in linux
thx
ASKER CERTIFIED SOLUTION
Avatar of owensleftfoot
owensleftfoot

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a few remarks:
- don't you have a GUI interface to do the changes, Yast2 or control center... ? (which linux?)
- in the manual editing case (1st answer) use "vipw"  and  "vipw -s" to edit passwd and shadows files - direct edition in some cases may lead to strange results...
hello, owensleftfoot
I can run your command sucessfully.
But in "chown that part"
i run
chown -R newusername newusername
and
chown -R newusername:newusername newusername
the group remains unchanged
how can i change it?
You can use "usermod -g newgroup" to change a users initial group.
oh....owensleftfoot
you help me alot, thx