`groups` 输出中的差异

dpq*_*dpq 1 unix permissions debian groups

为什么我执行groups输出时不包含adm组,而输出groups $USER有呢?用户应该在该组中。

lar*_*sks 5

如果您刚刚将用户添加到组中,则需要注销并重新登录才能获取新凭据。例如:

$ id
uid=500(lars) gid=500(lars) 
$ groups
lars
$ sudo usermod -G wheel,libvirt,mock lars
$ groups
lars
$ groups lars
lars : lars wheel libvirt mock
Run Code Online (Sandbox Code Playgroud)

如果我注销并重新登录:

$ groups
lars wheel libvirt mock
Run Code Online (Sandbox Code Playgroud)