Users and Permissions Flashcards
Which file stores passwords in a salted hash
/etc/shadow
What is UID
User id
What is GID
Group id
What are the contents of the /etc/shadow file
- Username
- Password as a salted hash (* or ! on the password could denote that the account has been locked possibly because of invalid login attempts)
- Date of last password change
- Days until a change is allowed
- Days before a change is required
- Days of warning before expiration
- Days between expiration and deactivation
- Expiration date
- Special flag
What is the difference between an expired and deactivated account
An expired account will force you to change your password on the next login before you can complete the login.
A deactivated account will require an admin to reactivate the account before you can login again.
Create a new group
newgroup
How to show current user
whoami
How to show all ids for the current user (user id, group ids)
id
How to show all ids for the current user (user id, group ids) or a specific user
id
when entered alone it will display info for the current user
id username will show info for the specified user account
Create a new user
sudo adduser username
Create a new user
sudo adduser username
this works like a wizard and allows to enter more info
OR
sudo useradd -s /bin/bash -d /home/jason -m -G groupName userName
sudo passwd userName
Search for users on the system
grep ‘^username’ -ne /etc/passwd
will find a line in the passwd file that starts with username
Change/Set password for a user
sudo passwd username
See password info for a user
sudo passwd -S username
or
sudo chage -l username
Which command is used to set password policies for a user
sudo chage username
use man chage to see details
change username
sudo usermod -l userNewName userOldName
change group
sudo groupmod -n groupNewName groupOldName
remove user
sudo deluser –remove-home username
sudo userdel -r username
check log of users deleted
cat /var/log/auth.log | tail -15 OR tail -15 /var/log/auth.log OR grep 'userdel' /var/log/auth.log
tail -15 just limits the output to the most recent items
how to add groups
sudo groupadd groupName
how to add user
sudo useradd -m tim -p password
- m makes home directory match username
- p is for password
add user to group
sudo usermod -a -G groupname username
search for a group
grep groupName /etc/group
rename a group
sudo groupmod -n newGroupName oldGroupName