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
usermod -l new_username -d /home/new_username -m old_username
sudo rm -r /home/temporary
permissions - How do I change my username? - Ask Ubuntu