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
create a ACL for a user on a file
setfacl -m user:: file.txt
setfacl -m user:bob:rwx /home/file.txt
setfacl -m u:bob:rwx /home/file.txt
-m = modify
create ACL for a group on a file
setfacl -m group:accounting:rx file.txt
setfacl -m g:accounting:rx file.txt
set ACL for a user and group in one command
setfacl -m u:bob:rwx,g:accounting:rx file.txt
create ACL for directory
setfacl -R -m user:bob:rwx /home/bob
-R = for files that currently exist in the directory
set default acl on directory
sudo setfacl -d -m user:bob:rwx dir1
ensures that new files will grant bob rwx
What are the three different options to delete and ACL
- x Remove specific acl
- k Remove all default acl
- b remove all acl