Each file, when created, has an owner and a group.
The permissions displayed of a file (or a directory) refer to the owner (whoever created the file), the group (to whom the file belongs) and others (the rest of users).
If the current user is not the owner and does not belong to the group of the file, then "others" apply.
list commands
permissions for a file or folder
ls -l name
list of files of a directory with permissions
ls -l
list of groups for current user
groups // users sales
list of groups for a certain user
groups peter // users manager
Symbols
There are two kinds of symbols:
Symbol type:
- ==> Regular file
d ==> Directory
l ==> Symbolic link
Symbol Permission
r ==> read
w ==> write
x ==> execute
There are three categories that these permissions can be applied to, which are user, group and other
Numeric Permission (octal mode)
r // w // x
0 // 0 // 0 ==>Base 10 (decimal) value for off
4 // 2 // 1 ==> Base 10 (decimal) value for on
some examples:
700 ==> -rwx------
664 ==> -rw-rw-r--
Symbol category
u ==> User
g ==> Group
o ==> Other
a ==> All (user, group and other)
Permission string
-rw-r--r--
The first character is a symbol type
From then on, there is three groups of three characters, that display the permissions for user, group and others, respectively.
Change permissions command
Permissions are also known as nodes, that is why the command to use is called chmod (change mode).
chmod mode file
chmod ==> The change mode command.
ugoa ==> The user category. One or more of u for user, g for group, o for other, a for all.
+ - = ==> One of +, -, or =. Use + to add permissions, - to subtract them, or = to explicitly set them.
rwx ==> The permissions. One or more of r for read, w for write, and x for execute.
examples:
chmod u+x script.sh
chmod g-w report.txt
chmod a+rw document.txt
chmod 755 my_program
chmod 644 file.txt
Don't be shy, leave us a comment