Permission#
Note that the following commands may need to be run with root permission.
Logout the user#
You need to logout the user before change username.
Change user and group name, for example, change username from older
to newer
:
1usermod -l newer older
2groupmod -n newer older
If system show the message usermod: user older is currently used by process xxxx
when you trying to enter the commands above, it means that you have not fully logged out all of this user.
You can check what process is hogging the user by htop
(or top
), and kill the process.
Or just kill the all processes which is run on this user, for example, to kill the all processes running by user older
:
1killall -u older
Btw, you can also use the w
(or who
) command to check which users are logged in.
Change home holder#
For example, the new username is newer
, enter the command:
1usermod -d /home/newer -m newer
If nothing else, the home folder of the user newer
has been changed to /home/newer
.
References#
- 《permissions - How do I change my username? - Ask Ubuntu》https://askubuntu.com/questions/34074/how-do-i-change-my-username