我熟悉useradd
和adduser
命令,但如果我使用其中任何一个命令创建新用户,则无法登录 GUI?!这是否意味着当系统基于 GUI 时,我被迫使用 GUI 来添加新用户?
答案1
如果你读过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
。