使用命令行添加新用户的最佳方法是什么?
我熟悉useradd
和adduser
命令,但如果我使用其中任何一个创建新用户,它无法登录GUI?! 这是否意味着当系统基于GUI时,我被迫使用GUI添加新用户?
如果你读过man useradd
你会看到:
DESCRIPTION useradd is a low level utility for adding users. On Debian, administrators should usually use adduser (8) instead.
因此,要添加用户,最好使用adduser
。
…但是如果我使用其中任何一个创建新用户,则无法登录GUI
这完全是假的! 使用adduser
创建新用户,创建新用户使用GUI所需的一切。 这是一个例子:
$ sudo adduser test [sudo] password for xxxx: Adding user `test' ... Adding new group `test' (1001) ... Adding new user `test' (1001) with group `test' ... Creating home directory `/home/test' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for test Enter the new value, or press ENTER for the default Full Name []: Test Test Room Number []: 7 Work Phone []: 456123 Home Phone []: 123456 Other []: This user is used for tests Is the information correct? [Y/n] n Changing the user information for test Enter the new value, or press ENTER for the default Full Name [Test Test]: Room Number [7]: Work Phone [456123]: Home Phone [123456]: Other [This user is used for tests]: Is the information correct? [Y/n] y
因此,绝对adduser
工具是使用命令行添加新用户的最佳方式!
另见: man adduser
。