root:~# useradd git root:~# ls /home wsl root:~# sudo adduser git adduser: The user `git' already exists. root:~# userdel -r git userdel: git mail spool (/var/mail/git) not found userdel: git home directory (/home/git) not found root:~# userdel -r git userdel: user 'git' does not exist
root:~# sudo adduser git Adding user `git' ... Adding new group `git' (1001) ... Adding new user `git' (1001) with group `git' ... Creating home directory `/home/git' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for git 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] y root:~# ls /home git wsl
使用id命令可以查看新用户的用户组以及uid等相关信息。
1 2
root:~# id git uid=1001(git) gid=1001(git) groups=1001(git)