RHCSA Ch6 Flashcards
change owner of a file
chown user1 file.txt
change group owner of a file
chown :accounting file.txt
Change user and group owners
chown user1:accounting file.txt
what are the values of rwx
r = 4 w = 2 x = 1
give user rwx, group rx, and other no permission - numeric and symbolic
chmod 750 file.txt
chmod u=rwx,g=rx,o= file.txt
giver user rwx using symbolic permissions
chmod u+rwx file.txt
take away execute from all users
chmod ugo-x file.txt
chmod a-x file.txt
a=all
explain umask
umask
default is 0022
default perms for directories are 777. Subtract 022 from 777 = 755 (rwx,rx,rx)
default perms for files is 666. Subtract 022 from 666 = 644 (rw,r,r)
changed umask
umask 0002 = only good for current session
To make persistent, edit ~/.bashrc and type umask 0002
To change system wide, edit /etc/profile.d/umask.sh
- if [ “$UID” -ge 1000 ] ;then
umask 0002
fi
^ for any user with an ID of 1000 or greater, their umask will be 0002
set the SUID bit on a file
sudo chmod 4755 /usr/bin/su
sudo chmod u+s /usr/bin/su
set the SGID bit to a file
chmod 2755 /usr/bin/screen
chmod g+s /usr/bin/screen
any file created in screen directory, will be own by that group
search for SUID and SGID set
SUID
find / -perm -4000
SGID
find / -perm -2000
What is the sticky bit
Makes sure that other users cannot move or delete a file in a directory with the sticky bit set
how do you set the sticky bit
chmod 1777 stickydirectory
list acl of a file
getfacl file.txt