Advanced User Man Flashcards
Set password aging parameters for user100 to mindays 7, maxdays 28, and warndays 5:
chage -m 7 -M 26 -W 5 user100
show pasword aging settings
chage -l user100
Set the account expiry to Jan 31 2020
chage -E 2020-01-31 user100
Set password aging attributes for user200 to mindays 10, maxdays 90, and warndays 14:
**with passwd
passwd -n 10 -x 90 -w 14 user200
see passwd status
passwd -S user200
set the number of inactivity days to 5
passwd -i5 user200
for user to change password at next login
passwd -e user200
lock a user
usermod -L user200
passwd -l user200
unlock user
usermod -U user200
passwd -u user200
Create the group linuxadm with GID 5000:
groupadd -g 5000 linuxadm
Create a group called dba with the same GID as that of group linuxadm:
groupadd -o -g 5000 dba
-o is needed as it is ‘non-standard’ and has the same GID as another group. Inherits same perms as other group
where are groups stored
/etc/groups
Add user1 as a secondary member of group dba using the usermod command. The existing membership for the user must remain intact.
usermod -aG dba user1
confirm user1 is in dba group
grep dba /etc/group
id user1
groups user1
alter name of linuxadm group to sysadm
groupmod -n sysadm linuxadm
change GID of a group
groupmod -g 6000 sysadm
delete group
groupdel sysadm
show who you are currently logged in as
whoami
show the identity of who originally logged in
logname
edit sudoers file
visudo
give user full access to admin functions with visudo
edit top of file
user1 ALL=(ALL) ALL
edit sudoer file so user1 does not have to use their password
visudo
user1 ALL=(ALL) NOPASSWD:ALL
give user sudo access to cat command
user1 ALL=/usr/bin/cat
Next, assign PKGCMD to PKGADM. This way one rule is set that allows a group of users access to a group of commands. You can add or remove commands and users anytime as needed, and the change will take effect right
away.
Cmnd_Alias PKGCMD = /usr/bin/yum, /usr/bin/rpm
User_Alias PKGADM = user1, user100, user200
PKGADM ALL = PKGCMD
change ownership of a file
chown user100 file.txt
change group ownership of a file
chgrp dbagroup file.txt
Change the ownership to user200 and owning group to user100
chown user200:user100 file.txt
Modify the ownership to user200 and owning group to dba recursively on dir10
chown -R user200:dba dir10