View file permissions:
ls -l file.txt
ls -ld mydir/ # Checks permissions on directory
ls -lR mydir/ # List permissions of files in dir
Set Ownership
chown root:root file.txt
chown -R root:root mydir/ # Makes everything in mydir to be owned by root
Examples of permissions and what they mean:
-rw-rw-r-- 1 root root 0 Dec 10 05:38
#
# - this is a regular file.
# rw- represent the owner's permissions.
# rw- group.
# r-- others.
Permissions:
r (read): 4
w (write): 2
x (execute): 1
Examples:
chmod 777 file.txt
chmod 650 file.txt
Top comments (0)