"The word 'radical' derives from the Latin word for root. Therefore, if you want to get to the root of anything you must be radical. It is no accident that the word has now been totally demonized..." -- Gore Vidal
First of all, let's figure out what the command "chmod" does.
chmod - The chmod command allows you to alter access rights to files and directories. All files and directories have security permissions that grant the user particular groups’ or all other users’ access. To view your files' settings, at the shell prompt type: ls -alt
You should see some files with the following in front of them (an example follows):
drwxrwsr-x 7 file1 file1 1024 Apr 6 14:30 .
drwxr-s--x 22 file2 file2 1024 Mar 30 18:20 ..
d-wx-wx-wx 3 file3 file3 1024 Apr 6 14:30 content
drwxr-xr-x 2 file4 file4 1024 Mar 25 20:43 files
What do the letters mean in front of the files/directories mean?
r indicates that it is readable (someone can view the file’s contents)
w indicates that it is writable (someone can edit the file’s contents)
x indicates that it is executable (someone can run the file, if executable)
- indicates that no permission to manipulate has been assigned.
When listing your files, the first character lets you know whether you’re looking at a file or a directory. It’s not part of the security settings. The next three characters indicate Your access restrictions. The next three indicate your group's permissions, and finally other users' permissions.
Use chmod followed by the permission you are changing. In very simple form this would be:
chmod 755 filename
The example above will grant you full rights, group rights to execute and read, and all others access to execute the file.
6 read and write
5 read and execute
4 read only
3 write and execute
2 write only
1 execute only
Still confused? Use the table above to define the settings for the three "users." In the command, the first number refers to your permissions, the second refers to group, and the third refers to general users.
Typing the command: chmod 751 filename
gives you full access, the group read and execute, and all others execute only permission.
I hope this article helps anyone having trouble with file permissions on linux. Don't forget to rate and comment. Thanks.
Cast your vote on this article 10 - Highest, 1 - Lowest
Comments: Published: 5 comments.
HackThisSite is is the collective work of the HackThisSite staff, licensed under a CC BY-NC license.
We ask that you inform us upon sharing or distributing.