在 Linux 中使用命令“id”?

And*_*dré 2 user-accounts permissions group-policy acl file-permissions

我对在 Linux 中使用命令id有一些疑问......

我已将一个用户(andre)添加到“github-total”组中,如果我执行id andre我得到:

$ id andre
uid=500(andre) gid=500(andre) groups=500(andre),502(github-total) context=user_u:system_r:unconfined_t
Run Code Online (Sandbox Code Playgroud)

但如果我只做id

$ id
uid=500(andre) gid=500(andre) groups=500(andre) context=user_u:system_r:unconfined_t
Run Code Online (Sandbox Code Playgroud)

问题是,当我只运行id而没有参数时,用户“andre”并没有假设他在“github-total”组中。而实际上用户不在组中。

所以我的问题是......如何将用户“andre”添加到“github-total”组中?

此致,

对不起我的英语。

Pau*_*aul 7

原因是您进行了更改,但尚未注销/重新登录。

当您不带参数运行 id 时,它会打印从父 shell 继承的数据,父 shell 在登录后查询数据库后建立组 ID。

当您使用用户名运行 id 时,它会立即查询数据库以查看该用户的组 ID 信息是什么。

所以......直接回答你的问题,注销然后重新登录。:-)