A)简短回答

A)简短回答

已安装HP Linux 成像和打印通过使用安装脚本,然后出现崩溃。现在我只是我自己群组的成员lp

例如,Ubuntu 12.10 中的用户默认组有哪些?与此相同

出于好奇,是否有地方记录这些信息?例如,某个日志文件显示我的用户上次启动时属于哪些组?这些信息(哪些组是默认的)是否记录在某处?

答案1

A)简短回答

默认组;以用户 123 为例,全新安装时 - (groups在终端中使用命令):

user123 adm cdrom sudo dip plugdev lpadmin sambashare

与 11.04 相比有差异

获取/查看默认值。可能也适用于其他各种情况;请执行以下操作:

sudo grep user-setup /var/log/installer/syslog


B) 恢复默认组

(添加此项以使其更加完整)

1. 识别群体

我总是设置 root 密码,但如果您没有使用 live CD、live USB、其他安装等来获取文件。

如果你设置root密码(通过ie):

sudo passwd root

并失去了sudo特权:

su - root
grep user-setup /var/log/installer/syslog

给你即

... user-setup: pwconv: failed to change the mode of /etc/passwd- to 0600
... user-setup: Shadow passwords are now on.
... user-setup: Adding user `user123' ...
... user-setup: Adding new group `user123' (1000) ...
... user-setup: Adding new user `user123' (1000) with group `user123' ...
... user-setup: Creating home directory `/home/user123' ...
... user-setup: Copying files from `/etc/skel' ...
... user-setup: addgroup: The group `lpadmin' already exists as a system group. Exiting.
... user-setup: Adding group `sambashare' (GID 124) ...
... user-setup: Done.
... user-setup: Adding user `user123' to group `adm' ...
... user-setup: Adding user user123 to group adm
... user-setup: Done.
... user-setup: Adding user `user123' to group `cdrom' ...
... user-setup: Adding user user123 to group cdrom
... user-setup: Done.
... user-setup: Adding user `user123' to group `dip' ...
... user-setup: Adding user user123 to group dip
... user-setup: Done.
... user-setup: Adding user `user123' to group `lpadmin' ...
... user-setup: Adding user user123 to group lpadmin
... user-setup: Done.
... user-setup: Adding user `user123' to group `plugdev' ...
... user-setup: Adding user user123 to group plugdev
... user-setup: Done.
... user-setup: Adding user `user123' to group `sambashare' ...
... user-setup: Adding user user123 to group sambashare
... user-setup: Done.
... user-setup: adduser: The group `debian-tor' does not exist.
... user-setup: Adding user `user123' to group `sudo' ...
... user-setup: Adding user user123 to group sudo
... user-setup: Done.
... ubiquity: Removing user-setup ...
... ubiquity: Purging configuration files for user-setup ...

或者:

su - root
grep "user-setup: Adding user user123 to group" /var/log/installer/syslog | cut -d' ' -f11

得出的结果是:

adm
cdrom
dip
lpadmin
plugdev
sambashare
sudo

(不知道为什么dip突然变成了安装的默认组。与被删除有关吗dialout?)


2.a 更新组 - 使用“内置”根访问权限

也一样,,为用户添加组,即用户user123

usermod -a -G adm,cdrom,lpadmin,sudo,sambashare,dip,plugdev user123

在哪里 (12.10 版本有些过时):

adm         Monitor system logs
cdrom       Use CD-ROM drives
lpadmin     Configure printers
sudo        administer the system, ...
sambashare  Share files with the local network
dip         Connect to the Internet using a modem
plugdev     Access external storage devices

您可能需要的一些额外物品:(检查您拥有的物品root@YOURPC:~# id -nG user123

dialout     ttyS*/Serial/COM1,COM2 ...
vboxusers   Virtual Box
user123     Your own group

如果您愿意,请仔细检查 /etc/group ,即(这里还有一些额外内容):

root@YOURPC:~# grep user123 /etc/group

adm:x:4:user123
audio:x:29:user123,timidity,pulse
video:x:44:user123
lp:x:7:user123
dialout:x:20:user123
cdrom:x:24:user123
sudo:x:27:user123
dip:x:30:user123
plugdev:x:46:user123
lpadmin:x:107:user123
user123:x:1000:
sambashare:x:124:user123
vboxusers:x:127:user123
autologin:x:1001:user123

另外,也可以启动救援模式,然后

mount -o remount,rw /
usermod -G adm,cdrom,lpadmin,sudo,sambashare,dip,plugdev user123

注销并登录. 群组应该更新。


2.b 更新组 - 使用 Live-CD 等的 root 访问权限。

xxx这是运行实时版本时文件系统的挂载位置,即/media/foo

/xxx/etc/group使用手动编辑文件维格尔并按照前面的清单添加用户。

或者;仅将用户添加到 sudo;如下所示:

sudo:x:27:user123

usermod通过执行以下命令启动安装并更新sudo

sudo usermod -a -G adm,cdrom,lpadmin,sudo,sambashare,dip,plugdev user123

注销并登录. 群组应该更新。


双重注释:admin从 11.10 开始不再是 Ubuntu 的一部分,取而代之的是sudo

答案2

除了自己的用户组之外,全新安装的用户还属于以下默认组:

Ubuntu 版本 默认组
Ubuntu 11.04 adm dialout cdrom plugdev lpadmin admin sambashare
Ubuntu 12.10 adm cdrom sudo dip plugdev lpadmin sambashare
Ubuntu 14.04 LTS adm cdrom sudo dip plugdev lpadmin sambashare
Ubuntu 15.10 adm cdrom sudo dip plugdev lpadmin sambashare
Ubuntu 18.04 LTS adm cdrom sudo dip plugdev lpadmin sambashare
Ubuntu 20.04 LTS adm cdrom sudo dip plugdev lpadmin sambashare

相关内容