CH 3: Managing Local Users and Groups Flashcards

1
Q

useradd

  • c
  • g
  • G
  • a
  • d
  • m
  • s
  • L
  • U
A
  • c add commont to the account such as real name
  • g: specify the primary group
  • G: specify a comma-separated secondary groups
  • a: append, use this with -G to add secondary groups
  • d specify a particulary home dir for account
  • m move users home directory to a new location
  • s: specify a login shell
  • L: lock the user account
  • U: unlock user account
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

difference between userdel and userdel -r

A

using the -r removes the user from /etc/passwd as well as deletes home directory

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

default ranges of UIDs/GIDs

A

0 is root
1-999 is for the system
1000+ is for local users
defined in /etc/login.defs

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

create a regular group

create a system group

A

groupadd new_group. (GID will be >1000)

groupadd -r new_sys_group (GID will be <1000)

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

delete a group

A

groupdel group_name

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

modify a group such as changing the name

A

groupmod -n new_name old_name

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

configuring password age with chage

  • m 2
  • M 90
  • W 7
  • I 14
A
  • m 2 means min password age until it can be changed
  • M 90 means password can be max 90 days old
  • W 7 means warn 7 days before Max PW age
  • I 14 means set the account disabled after 14 days
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

set users account to expire in 45 days

A

date -d “+45 days” + %F
2020-10-25

then run: chage -E 2020-10-24

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

Expire a user account

Unlock a user account

prevent a user from logging in

A

usermod -L

usermod -U

usermod -s /sbin/no login

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

set password to expire immediately

A

chage -d 0 user

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

view password/account expiry info

A

chage -l username

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

set new accounts expiry info automatically

A

modify PASS_MAX_DAYS in /etc/login.defs

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

show all groups a user is a member of

A

lid

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

show all members of a group

A

lid -g

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