CH 3: Managing Local Users and Groups Flashcards
useradd
- c
- g
- G
- a
- d
- m
- s
- L
- U
- 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
difference between userdel and userdel -r
using the -r removes the user from /etc/passwd as well as deletes home directory
default ranges of UIDs/GIDs
0 is root
1-999 is for the system
1000+ is for local users
defined in /etc/login.defs
create a regular group
create a system group
groupadd new_group. (GID will be >1000)
groupadd -r new_sys_group (GID will be <1000)
delete a group
groupdel group_name
modify a group such as changing the name
groupmod -n new_name old_name
configuring password age with chage
- m 2
- M 90
- W 7
- I 14
- 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
set users account to expire in 45 days
date -d “+45 days” + %F
2020-10-25
then run: chage -E 2020-10-24
Expire a user account
Unlock a user account
prevent a user from logging in
usermod -L
usermod -U
usermod -s /sbin/no login
set password to expire immediately
chage -d 0 user
view password/account expiry info
chage -l username
set new accounts expiry info automatically
modify PASS_MAX_DAYS in /etc/login.defs
show all groups a user is a member of
lid
show all members of a group
lid -g