I've been setting up my new workstation and wanted to add groups to my user such as 'operator' and 'video' but came across some unexpected behavior that I hope someone shed some light on.
Currently, the output using
Case1:
Getting to the nitty-gritty, if I issue the following command(notice only space between groups)
In this case, only the first group (wheel) is added to the user.
Case 2:
If I issue the following command (notice commas between groups)
In this case, all the groups (wheel,operator,video,cups) are added to the user.
The issue comes in when I read the man page (pw):
It seems that only separating the group list with commas works as opposed to space or tab-separated list. Of course, I could be and probably are reading too much into the man page or just misinterpreting it.
Please let me know what you think.
73,
Scott - w5plt
Currently, the output using
uname -a
is:
Code:
FreeBSD fisher.loga.us 11.2-RELEASE-p4 FreeBSD 11.2-RELEASE-p4 #0: Thu Sep 27 08:16:24 UTC 2018 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
Case1:
Getting to the nitty-gritty, if I issue the following command(notice only space between groups)
pw usermod cres24 -G wheel operator cups
the result is as follows after a reboot: root@fisher:~ % id cres24
Code:
uid=1002(cres24) gid=1002(cres24) groups=1002(cres24),0(wheel)
In this case, only the first group (wheel) is added to the user.
Case 2:
If I issue the following command (notice commas between groups)
pw usermod cres24 -G wheel,operator,video,cups
the result is as follows after a reboot: root@fisher:/ # id cres24
Code:
uid=1002(cres24) gid=1002(cres24) groups=1002(cres24),0(wheel),5(operator),44(video),193(cups)
In this case, all the groups (wheel,operator,video,cups) are added to the user.
The issue comes in when I read the man page (pw):
Code:
-G grouplist Set secondary group memberships for an account. grouplist
is a comma, space, or tab-separated list of group names or
group numbers. The user is added to the groups specified
in grouplist, and removed from all groups not specified.
The current login session is not affected by group member-
ship changes, which only take effect when the user recon-
nects. Note: do not add a user to their primary group with
grouplist.
It seems that only separating the group list with commas works as opposed to space or tab-separated list. Of course, I could be and probably are reading too much into the man page or just misinterpreting it.
Please let me know what you think.
73,
Scott - w5plt