Managing users & Groups Flashcards

1
Q

What command do we use to create a user account?

A

useradd

  • c Full Name
  • e Expiration date
  • s Default shell
  • d Home directory

useradd jdoe -c “John Doe” -e 2019/12/31 -s /bin/dash -d /home/john_doe

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

What is userdel command in Linux?

A

Stands for: User delete

Function: Delete a user account and related files

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

What command and option is for completely deleting a user?

A

userdel -r

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

What command modifies a user account?

A

usermod

  • Rename account: usermod -l jdoe jsmith
  • Lock account: usermod -L jdoe
  • Unlock account: usermod -U jdoe
  • Add user to group: usermod -a -G Marketing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What command changes the login shell of username?

A

chsh

  • Prevent an account from logging in interactively
  • e.g. chsh -s /bin/nologin
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the command to set or change a user password?

A

passwd

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

How do you set an expiration for a user account password?

A

*chage

Define password expiration policy

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

How do you display current password info for a user?

A

*Display current info

chage -l jdoe

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

How do you modify a password policy for a user?

A

*Modify policy

chage -m -M -E -W jdoe

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

How do you display defaults of a user account?

A

useradd -D (displays defaults)

List of defaults
/etc/login.defs
/etc/default/useradd
/etc/skel

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

How can we verify a user account’s configuration?

A
*/etc/passwd (account info)
Defines accounts
User ID
UIDs typically start at 500
Users/Groups can share an ID (not ideal)
*/etc/shadow (password file)
*/etc/group (group association)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What command do we use to create groups?

A

*groupadd
groupadd Marketing

*/etc/group
list of groups
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Are we able to modify the group once it is created?

A

YES

*groupdel (deletes group)

*groupmod (modifies)
(-n Rename group)
groupmod -n

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

How do we put user accounts into the groups?

A

gpasswd

*Add a user
gpasswd -a

*Remove a user
gpasswd -d

*Add a group admin
gpasswd -A

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

Are secondary group permissions applied automatically?

A

NO

Users perform all actions under their primary group by default

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

What does the newgrp command do?

A

The newgrp command is used to change the current group ID during a login session.

17
Q

What does the chgrp command do?

A

The chgrp (change group) command alters the group name that a file or directory belongs to.

18
Q

What does the groups command do?

A

The groups command lists the groups that a user belongs to.

groups

19
Q

Are there any other ways to verify a group’s configuration?

A

getent passwd (looks into etc/passwd and looks for user info)

getent shadow (looks into etc/passwd and looks for user password)

getent group  (looks into etc/passwd and looks for user group)
groups  (lists all groups that user is part of)