更改linux主机名用户名
I want to rename a user’s username on Linux. For example, rename user u1 to user1. How to change a user’s username on Linux?
我想在Linux上重命名用户的用户名。 例如,将用户u1重命名为user1。 如何在Linux上更改用户的用户名?
You can use the usermod command to modify the user’s info.
For changing the user name, you can use the -l
option:
要更改用户名,可以使用-l
选项:
-l, –login NEW_LOGIN
-l –登录NEW_LOGIN
The name of the user will be changed from LOGIN to NEW_LOGIN. Nothing else is changed. In particular, the user’s home directory or mail spool should probably be renamed manually to reflect the new login name.
用户名将从LOGIN更改为NEW_LOGIN。 什么都没改变。 特别是,用户的主目录或邮件后台打印程序可能应该手动重命名以反映新的登录名。
For your specific example, the command will be (run as root or by sudo)
对于您的特定示例,命令将是(以root或sudo运行)
usermod -l user1 u1
翻译自: https://www.systutorials.com/how-to-change-a-users-username-on-linux/
更改linux主机名用户名