What do these file permissions mean? I am unable to understand them i tried looking at the 0-7 meanings but im unsure when they are together.
-r-------x
----rw----
-rwx--x--x
What do these file permissions mean? I am unable to understand them i tried looking at the 0-7 meanings but im unsure when they are together.
-r-------x
----rw----
-rwx--x--x
From left to right, linux filesystem permissions are flags grouped in 3s
User (owner), Group, All
rwx------ = User can Read, Write, Execute
---rwx--- = Group can Read, Write, Execute
------rwx = All can Read Write, Execute
(I did not mention the flags for directory or setuid, on purpose)
etc
Next, you do not need to memorize numeric values for doing the setting
Use
chmod
with mnemonicschmod a+r
set the file such that All can Readchmod g+r
set the file such that Group can Readchmod u+x
set the file such that User can ExecuteFile permissions
Linux uses the same permissions scheme as Unix. Each file and directory on your system is assigned access rights for the owner of the file, the members of a group of related users, and everybody else. Rights can be assigned to read a file, to write a file, and to execute a file (i.e., run the file as a program).
To see the permission settings for a file, we can use the ls command as follows:
CHMOD
The chmod command is used to change the permissions of a file or directory. To use it, you specify the desired permission settings and the file or files that you wish to modify. There are two ways to specify the permissions, but I am only going to teach one way.
It is easy to think of the permission settings as a series of bits (which is how the computer thinks about them). Here's how it works:
and so on...
Here is a table of numbers that covers all the common settings. The ones beginning with "7" are used with programs (since they enable execution) and the rest are for other kinds of files.
Directory permissions
The chmod command can also be used to control the access permissions for directories. In most ways, the permissions scheme for directories works the same way as they do with files. However, the execution permission is used in a different way. It provides control for access to file listing and other things. Here are some useful settings for directories:
Permissions as numbers are 3 octal numbers. 555, for example, when converted to 3 binary numbers is 101 101 101 which would correspond to r-x r-x r-x. The first set is owner, second set is group, third set is everyone else.
r = read
w = write
x = execute
If any of those are missing (-), then that set does not have those permissions.
It's also
owner|group|all
owner can read, group can do nothing, others can excecute
owner can do nothing, group can read and write, others can do nothing
owner has full permission, group can execute, others can execute.
the first - is for special permissions such as sticky bit.
Here's a site that may help you.