Users and Permissions Flashcards

1
Q

Which file stores passwords in a salted hash

A

/etc/shadow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is UID

A

User id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is GID

A

Group id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the contents of the /etc/shadow file

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between an expired and deactivated account

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create a new group

A

newgroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to show current user

A

whoami

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to show all ids for the current user (user id, group ids)

A

id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to show all ids for the current user (user id, group ids) or a specific user

A

id
when entered alone it will display info for the current user

id username will show info for the specified user account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create a new user

A

sudo adduser username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create a new user

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Search for users on the system

A

grep ‘^username’ -ne /etc/passwd

will find a line in the passwd file that starts with username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Change/Set password for a user

A

sudo passwd username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

See password info for a user

A

sudo passwd -S username

or

sudo chage -l username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which command is used to set password policies for a user

A

sudo chage username

use man chage to see details

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

change username

A

sudo usermod -l userNewName userOldName

17
Q

change group

A

sudo groupmod -n groupNewName groupOldName

18
Q

remove user

A

sudo deluser –remove-home username

sudo userdel -r username

19
Q

check log of users deleted

A
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

20
Q

how to add groups

A

sudo groupadd groupName

21
Q

how to add user

A

sudo useradd -m tim -p password

  • m makes home directory match username
  • p is for password
22
Q

add user to group

A

sudo usermod -a -G groupname username

23
Q

search for a group

A

grep groupName /etc/group

24
Q

rename a group

A

sudo groupmod -n newGroupName oldGroupName

25
how to disable user
sudo passwd -l userName
26
how to enable user
sudo passwd userName
27
command to change owner of file or directory
sudo chown userName tim | must use root because you must have access to the current owner and the new owner
28
command to change group of file or directory
sudo chown userName:groupName fileOrDirName sudo chown :groupName fileOrDirName **Need more info for this below** sudo chgrp can do it without sudo (root) if you are in both groups
29
change the default permissions of created files and directories for a user
umask default files are created with 666 permissions default directories are created with 777 permissions
30
Which command option tells Linux to run the program with the permissions of whoever owns the file rather than with the permissions of the user who runs the program.
suid
31
What are two special permission bits exist, similar to the sticky bit?
SUID and GUID The SUID and SGID are special permission bits. SUID (Set owner User ID up on execution) is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SUID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file owner rather that the user who runs it. SGID permission is similar to the SUID permission, the only difference is – when the script or command with SGID on is run, it runs as if it were a member of the same group in which the file is a member.