快轉到主要內容

Change username and home folder in ubuntu

·189 字
Computer-Science Ubuntu
目錄

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
#

Alpaca
作者
Alpaca
No one can stop my feet.

相關文章

Ubuntu "Crontab" 工作排程
·1115 字
Computer-Science Ubuntu
Ubuntu Server Auto Login TTY when Start up
·443 字
Computer-Science Ubuntu
How to set timezone on ubuntu?
·183 字
Computer-Science Ubuntu
Ubuntu 更改家目錄語言
·574 字
Computer-Science Ubuntu

簡單幾步變更家目錄的語言

Ubuntu 更換 /Home 到新硬碟
·1364 字
Computer-Science Ubuntu Disk

如果發現當初掛載好的空間不夠用了,那麼擴充硬碟上去,然後照著步驟一步步的將檔案們搬家吧。

How to use PPPoE to connect network on Ubuntu?
·353 字
Computer-Science Ubuntu PPPoE

在 Ubuntu 用 PPPoE 連線中華電信固定 IP。