usermod 说帐户不存在,但 adduser 说帐户存在

A. *_*ghi 7 adduser accounts

我运行命令

usermod -a -G dialout amashreghi
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用 adduser 添加用户时,我发现 amashreghi 不存在

adduser amashreghi
Run Code Online (Sandbox Code Playgroud)

它说 amashreghi 已经存在。这是怎么回事?!

abu*_*bua 5

/etc/group直接使用vigr进行编辑

man vigr

NAME
       vipw, vigr - edit the password, group, shadow-password or shadow-group file

SYNOPSIS
       vipw [options]

       vigr [options]

DESCRIPTION
       The vipw and vigr commands edits the files /etc/passwd and /etc/group, respectively. With the -s flag,
       they will edit the shadow versions of those files, /etc/shadow and /etc/gshadow, respectively. The
       programs will set the appropriate locks to prevent file corruption. When looking for an editor, the
       programs will first try the environment variable $VISUAL, then the environment variable $EDITOR, and
       finally the default editor, vi(1).
Run Code Online (Sandbox Code Playgroud)

因此,您可以/etc/group使用以下命令编辑该文件

sudo vigr
Run Code Online (Sandbox Code Playgroud)

组条目的格式可以在 man 中找到。从man group

NAME
       group - user group file

DESCRIPTION
       The  /etc/group file is a text file that defines the groups on the system.  There is one entry per line,
       with the following format:

           group_name:password:GID:user_list

       The fields are as follows:

       group_name  the name of the group.

       password    the (encrypted) group password.  If this field is empty, no password is needed.

       GID         the numeric group ID.

       user_list   a list of the usernames that are members of this group, separated by commas.

FILES
       /etc/group
Run Code Online (Sandbox Code Playgroud)