[翻译] Linux adduser 和 useradd 命令的区别
原文链接
What's the difference between “adduser” and “useradd”? | superuser
useradd 命令是操作系统原生的二进制命令。但是 adduser 是一个通过调用 useradd 二进制命令的 perl 脚本。
adduser 命令比起 useradd 更加用户友好。它们俩在功能上没有差别。
$ man adduser
adduser [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos GECOS] [--add_extra_groups] [--encrypt-home] user
...
在测试 adduser 命令中:
root@c7c4e9678a02:/home# adduser --home /home/imzhi5 --disabled-password --quiet imzhi5
Changing the user information for imzhi5
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
即需要 change the user information,没有办法绕过去,也就是需要额外敲击 6 次回车键,一个用户才真正的创建成功。
而相比起来,useradd 命令就没有这种提示:
$ useradd -m -d /PATH/TO/FOLDER USERNAME
参考链接
What's the difference between “adduser” and “useradd”? | superuser
Create the home directory while creating a user | Ask Ubuntu