ubuntu修改用户名并修改home对应的目录名

1.新建一个新的用户user2

sudo adduser temporary
sudo adduser temporary sudo

2.从user1 logout。进入新建用户user2,修改user1的名字和home目录名

sudo usermod -l new_username -d /home/new_username -m user1

3.从user2中logout,进入user1(new_username),删除user2.

sudo deluser temporary
sudo rm -r /home/temporary

usermod -l new_username -d /home/new_username -m old_username
permissions - How do I change my username? - Ask Ubuntu
posted @ 2017-09-22 19:54  juejiang  阅读(4592)  评论(0编辑  收藏  举报