perm types:
r
- read permw
- write permx
- execute perm
giving ownership to a specific user:
sudo chown username path/file
giving perms to a group:
sudo chgrp groupname file/program
checking perms:
ls -la
- explanation:
- file type
- d = directory
-
- = file
- perms on the file for the owner, group and other users in order
- example:
- owner has read write and execution perms
- group has read and execute perms
- other users have the same perms as the group
- file owner
- file group
- file size in bytes
- date and time of last modification or creation
- file name
- file type
changing file perms:
- only the root user and owner can change file perms
- two ways to change perms
- Binary-Octal Method
- Symbolic method
Binary-Octal Method:
- easier way to remember (use the 1, 2 4 rule):
- if we wanna give a file with
rw-r--r--
permsrwxrwxr-x
perms:sudo chmod 775 filename
Symbolic Method:
- syntax after
chmod
:- u - user
- g - group
- o - others
-
- removes a perm
-
- adds a perm
- = sets a perm
- example:
sudo chmod u-w filename
(removes write perms from user)sudo chmod u-w,g+x filename
(removes write perms from user and adds execute perms to the group)
- owner: rwx
- group: r-x 55
- other: r—