thohoh
3/2/2018 - 8:14 PM

managing users

usermod -aG groupname $username

# Removes all suplementary groups
usermod -G "" username

# Remove user from specific group
gpasswd -d user group
# Check you the fuck you're logged in as
whoami

# print users currently logged into the host
users

# print groups the user are in. If username is not specified then prints groups of current user
groups <?username>

# switching between users
su - username

# switch to root
su -

# launch a new shell with specified user
sudo -u username bash

# Adding a new user
adduser $username
# Set password for existing user.
sudo passwd $username