Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.
Permission management
User permissions
Understanding /etc/shadow
useradd
- -u UID
- -c ‘msg’
- -g initial group
- -G supplementary groups
- -d home directory
- -s shell
- -e YYYY-MM-DD # password expiration date
- -f num # days after password expiry the account may still be used; -1 = never lock; 0 = lock immediately
- -D # show defaults
usermod
- -L # lock
- -U # unlock
- -aG group_name # append supplementary groups instead of replacing
- other flags same as useradd
userdel
- -r # remove home directory
passwd
- -l # lock user
- -u # unlock
- -S # show password status
- -n num # minimum days between password changes
- -x num # maximum days before password must change
- -w num # warn this many days before deadline
- -i YYYY-MM-DD # password inactive after this date
- –stdin # set password from a pipe
chage
- -l # show password aging info
- -d YYYY-MM-DD # last password change; 0 forces change on next login
- -m num # minimum days between changes
- -M num # maximum days before change required
- -w num # warn days before deadline
- -I YYYY-MM-DD # password inactive date
- -E YYYY-MM-DD # account expiration date
Group permissions
groupadd
- -g GID
- -r system group
groupmod
- -g GID
- -n new group name
groupdel
groups
- first line shown is the effective group
gpasswd
- gpasswd group # set group password
- -A user group # set group administrator
- -a user group # add member
newgrp
- switch effective group
finger
- finger user # plan text:
echo 'str' >~/.plan
chfn
- -f # full name
- -o # office
- -p # phone
- -h # home phone
chsh
- -l # list shells
- -s # change your shell
id
- id newbmiao # inspect account attributes
ACL control
setfacl
- -m u:[users]:rwx file
- -m d:u:[users]:rwx dir # default ACL for new children
- -m g:[groups]:rwx file
- -m m:rwx file # mask — effective permission is intersected with mask (caps maximum permission)
- -b file # remove ACL
getfacl
Questions? Leave a comment below or email: newbvirgil@gmail.com![]()
