Created lørdag 22 oktober 2016
# List files owned by a user or group
$ find / -group <GROUP_NAME>
$ find / -user <USER_NAME>
# Who is logged in
$ who
# Who are you logged in as
$ whoami
User Directories
# To create the typical directories - Desktop, Document, Download etc.
# This can easily be done with xdg-user-dirs
$ pacman -S xdg-user-dirs
# Then create the directories
$ xdg-user-dirs-update
# To change the default directories, you can edit ~/.config/user-dirs.dirs
User management
# To see all users : sudo passwd -Sa
# Getting UID's : id -u <USER_NAME>
Adding a user
# Adding users can be done with useradd - set password after creating the user.
-m = create a /home folder for the user
-s = path to default login shell
# Creating the user and setting the password
$ useradd -m -G wheel -s /bin/bash <USER_NAME>
$ passwd <USER_NAME>
Delete user
# -r removes the home directory for the user
$ userdel -r <USER_NAME>
Change login name
$ usermod -l <NEW_NAME> <OLD_NAME>
Change home directory
# -m creates the required folders and move the content there
$ usermod -d /my/new/home -m <USER_NAME>
Add user to a group
$ usermod -aG <ADDITIONAL_GROUPS> <USER_NAME>
# Or
$ gpasswd --add <USER_NAME> <GROUP_NAME>
Remove user from a group
# If the user is logged in, changes will take affect after logout
$ gpasswd -d <USER_NAME> <GROUP_NAME>
Expire password requiring them to create a new on first login
$ chage -d 0 <USER_NAME>
Group management
# List groups that a user is member of
$ groups <USER_NAME>
# List all groups on the system
$ cat /etc/group
# Create a new group
$ groupadd <GROUP_NAME>
# Delete group
$ groupdel <GROUP_NAME>
User groups
# Below is a list of general user groups.
# users can, and sometimes have to, be added to these groups without worries.
adm # admin group, similar to wheel
ftp # access to file-server by ftp-servers
games # access to some game software
http # access to files served by the HTTP server
log # access to logs in /var/log/
rfkill # access to control wireless power (TX-power)
sys # access to administrate printers
users # standard user group
uucp # RS-232 ports and their connected devices (old keyboard, printer, mouses etc)
wheel # administration group commonly used to give access to sudo/su none is set by default