用户组问题

用户组问题

最近我注意到一件奇怪的事情,我在网上搜索时无法弄清楚。

并给予groupsid

$ groups 
q
$ id
uid=1000(q) gid=1000(q) groups=1000(q)

但明确传递的参数会改变结果

$ groups q
q : q adm tty disk lp uucp dialout cdrom sudo audio dip video plugdev 
users lpadmin pulse pulse-access sambashare vboxusers input wireshark docker libvirt

$ id q
uid=1000(q) gid=1000(q) groups=1000(q),4(adm),5(tty),6(disk),7(lp),10(uucp),20(dialout),24(cdrom),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),108(lpadmin),122(pulse),123(pulse-access),124(sambashare),125(vboxusers),148(input),153(wireshark),155(docker),160(libvirt)

来自男人

概要

id [选项]...[用户]

描述

打印指定 USER 或(当省略 USER 时)当前用户的用户和组信息。

$ sudo -i -u q

$ groups
q adm tty disk lp uucp dialout cdrom sudo audio dip video plugdev users lpadmin pulse pulse-access sambashare vboxusers input wireshark docker libvirt
$ id
uid=1000(q) gid=1000(q) groups=1000(q),4(adm),5(tty),6(disk),7(lp),10(uucp),20(dialout),24(cdrom),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),108(lpadmin),122(pulse),123(pulse-access),124(sambashare),125(vboxusers),148(input),153(wireshark),155(docker),160(libvirt)

/dev/vboxusb此问题对文件系统项访问有副作用。VirtualBox 等应用程序直到才能访问sudo -i -u q

我使用的是 Ubuntu 18.04 LTS。如何修复?

相关内容