Run the following command
Ls- l
And you will get an output
-rw-rw-r– 1 guest123 guest123 7 Apr 7 20:11 test
drwxrwxr-x 2 guest123 guest123 4096 Apr 7 20:11 test1
The file was created on April 7th at 8:11pm called test. The file belongs to the user guest123 and group guest123.
The dashes separate the permissions into three types
1st part refers to the owner permissions
2nd part refers to group permissions
3rd part refers to other users
The file basically says “-rw-rw-r—“ first “-“ means it is a file. The first rw means the owner can read and write, the 2nd rw means the group can read and write, and the 3rd means the outside folks can only read the file.
The directory basically says “drwxrwxr-x” first “d” means it is a directory. The 1st rwx means owner has read/write and execute, 2nd rwx means group has read/write and execute, 3rd means the outside folks only has read and execute.
You can always change everybody permissions if you don’t like what the default permissions with the command chmod.
Example for chmod
Chmod permissions file (chmod 777 file)
Chmod 777 /home/guest123/test
Changes my file too:
-rwxrwxrwx 1 guest123 guest123 7 Apr 7 20:11 test
Noticed how everyone has read/write/execute permissions
Number are as follows:
Owner
Group
Outside
When you want to assign permissions you have to do all three levels.
To find out what you permissions fit you:
4 = read
2 = write
1 = execute
Add those numbers up you get 7.
7 = read/write/execute
6 = read/write
5 = read/execute
4 = read
3 = write/execute
2 = write
1 = execute