Hot answers tagged

222

You can display with the help of compgen builtin command as follows: To display all users run following command: compgen -u To display all groups run following command: compgen -g However you can also display all users by cut -d ":" -f 1 /etc/passwd.


63

After adding to a existing user: usermod -a -G group user You may need to logout and login to get the groups permissions from /etc/group.


61

There is no inherent difference between system groups and 'normal' groups, just like there is none between system users and regular users. It is by convention that human users are assigned uids from a certain number (e.g. 1000) upwards, whereas system users get uids in a range below that number. The actual uid number, apart from the special uid 0 which is ...


50

In your host, run this command: sudo usermod -a -G vboxusers $USER Now perform a logout (always required after add current user to a group). After login, check that you are in the vboxusers group with this command, make sure that vboxusers is in the shown list: groups $USER


47

Use the getent command for processing groups and user information, instead of manually reading /etc/passwd, /etc/groups etc. The system itself uses /etc/nsswitch.conf to decide where it gets its information from, and settings in the files may be overridden by other sources. getent obeys this configuration. getent prints data, no matter the source, in the ...


33

adm: Group adm is used for system monitoring tasks. Members of this group can read many log files in /var/log, and can use xconsole. Historically, /var/log was /usr/adm (and later /var/adm), thus the name of the group. admin: The admin group is used to grant sudo access on ubuntu 11.10 and earlier. It's still found on 12.04 for backwards compatibility.


30

This can be simply done with cut: $ cut -d: -f3 < <(getent group sudo) 27 getent group sudo will get the line regarding sudo group from /etc/group file : $ getent group sudo sudo:x:27:foobar Then we can just take the third field delimited by :. If you want the output string accordingly, use command substitution within echo: $ echo "Group sudo ...


17

Ubuntu is based on Debian, and the users follow the same philosophy. I therefor quote Debians explanation of System Groups: users: While Debian systems use the private user group system by default (each user has their own group), some prefer to use a more traditional group system, in which each user is a member of this group. It's not used on Ubuntu (and ...


17

You can use: find . \! -perm /070 Or: find . \! -perm /g+rwx This works because: When the operand of the -perm test starts with /, it causes -perm to test if any of the specified permissions are present. (If you used - in place of /, it would test if all were present. Without a prefix character, it would test for exactly the permission specified, i.e., ...


15

The primary group is the group applied to you when you log in using the usual methods (TTYs, GUI, SSH, etc.). Since processes usually inherit the group of the parent, and your initial process or shell would have your primary group as the group, anything you do usually has the effect of the primary group on it (creating files, for example). The secondary ...


15

The command loginctl terminate-user <user> worked for me. (Replace <user> with your user name) You probably shouldn't run this when logged in though as it will kill all your processes.


14

getent group <group_name> queries the /etc/group file and gets the entry for the mentioned group from the file. The output format is: group:password:GID:user(s) group is the group's name password is the encrypted group password, empty field signifies no password, x bit signifies the password is in the file /etc/gshadow GID is the Group ID user(s) ...


14

You can use pam_succeed_if module (see manual page) before the pam_google_authenticator to skip this part for your group: # the other authentication methods, such as @include common-auth auth [success=1 default=ignore] pam_succeed_if.so user ingroup group auth required pam_google_authenticator ...


13

I'm posting this as an answer because I don't have enough reputation to comment. As @dpendolino's mentioned, for the effects of this command to persist: sudo usermod -a -G groupName userName ...you need to logout/login again. However, if you need a shortcut to start using your new group membership immediately (and you have the correct sudo privileges) I ...


12

This works for me and my problem with VirtualBox was solved sudo usermod -a -G vboxsf "$USER"


12

When "logging out" of the default desktop in ubuntu 18.04, some of the user's processes are not terminated immediately, but linger around. These are (observed by another user): $ ps axu | grep ^ludwig ludwig 26508 0.3 0.2 77052 8308 ? Ss 23:32 0:00 /lib/systemd/systemd --user ludwig 26509 0.0 0.0 261776 2968 ? S 23:32 0:...


11

I assume you're using bash as your shell. Bash doesn't set a GID variable. The list of Bash variables mentions EUID and UID, but not GID. Zsh, on the other hand, does set GID: $ bash -c 'echo $GID' $ zsh -c 'echo $GID' 1000


10

This is documented in the man page. From man groupdel: You may not remove the primary group of any existing user. You must remove the user before you remove the group. So you need to make the primary group of user administrator something other than pro1 and then you should be able to remove group pro1. Example: $ sudo groupdel foobar groupdel: ...


10

Quoting the respective manual page man group: NAME group - user group file DESCRIPTION The /etc/group file is a text file that defines the groups on the sys‐ tem. There is one entry per line, with the following format: group_name:password:GID:user_list The fields are as follows: group_name the name of ...


9

To add a particular user to a particular group use: sudo usermod -a -G groupname username Here a is very important because otherwise the user will be removed from all other groups Your problem is probably because you missed the -a part in your command


8

sudo usermod -a -G groupName userName will work just fine, but I had to reboot entirely, just log out and log in again did not do the job...


8

Working out what a user can do is hard if you're not that user. You can test various things (is owner, same group, etc) but ACL might apply, there might be no permissions in the mount, who knows. It's hard. If you can turn into that user, you can test -w <path> to see if they can write. This isn't as fast as just looking at the inode but it's possible ...


8

Ok, as nudged by @muru, I'm posting an answer to my own question, to the extent I can. The file file:///usr/share/doc/base-passwd/users-and-groups.html includes detailed information on groups and permissions. A mirror of this page can be found here: Users and Groups Accordingly: staff Allows users to add local modifications to the system (/usr/...


8

Just to sum up with some of the great information from steeldriver in the comments; Install drivers following AMD's instructions Copy sudo usermod -a -G video $LOGNAME into a terminal Type groups. If video isn't listed, then log out and log back in. (Thanks again steeldriver) Hopefully, you should be able to log in. Go into a terminal and type groups ...


8

adduser and usermod are two different utilities which have in common the fact that both can add a user to a group. According to man adduser adduser is friendlier front ends to the low level tools like useradd, groupadd and usermod programs. More info: man adduser : adduser, addgroup - add a user or group to the system man usermod : usermod - ...


8

When you create a user, a group will be created with the same name and will be set as newly created user's primary group. You can find out what your primary group name is using: id -gn The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user: getent passwd $USER it should ...


7

On Ubuntu, since logging in as root is not enabled, users in the sudo group can elevate privileges for certain restricted commands. Any restricted command must be prepended with sudo to elevate privilege. sudo usermod -a -G group user will add the existing user user to a supplemental group named group. The user's primary group will remain unchanged.


7

The default groups are: {user} adm cdrom sudo dip plugdev lpadmin sambashare Where {user} is your username. When adding new groups to your user on the command-line, to avoid losing membership of other groups, use: sudo usermod -aG {group1},{group2},{group3} {user} The -a option of usermod appends the new group onto your user's list of groups, without ...


7

If you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group. Warning: The docker group grants privileges equivalent to the root user. For details on how this impacts security in your system, see ...


7

To find any file in the current directory or its subdirectories for which none group read, write or execute bits are set, run: find . ! -perm /g+rwx


Only top voted, non community-wiki answers of a minimum length are eligible