Skip to content

List users & groups

cat /etc/passwd
cat /etc/passwd | grep 'snap'

ofwel (identiek resultaat)
Database entries configured in the /etc/nsswitch.conf file include the passwd database with all the usernames and login information.
To extract this data :

getent passwd

output :
fields are separated by : (colons) and each line includes the following information:
1. Username
2. The encrypted password (represented by x, located in the /etc/shadow file)
3. User ID number (known as UID)
4. User group ID (known as GID)
5. User full name
6. User home directory
7. The login shell (by default set to bin/bash)

list the groups the current user is in
groups
the first group mentionned is the primary group of the particular user.

ofwel specifieer username
groups ward groups root etc

add a user to a group

to add the user geek to the group sudo , use :
usermod -a -G vboxusers ward
usermod -a -G vboxusers ward $USER
( $USERNAME is bij mij blanko , $USER is wel = ward )
or
sudo adduser $USER vboxusers