USAGE:
#chmod 754 file_name.txt
chmod is a command used to change the permissions of a flie(s). When using the ls -l command, permissions of a file are shown on the first column from the left. The first character in this column tells us what type of file it is. A dash for a normal file and "d" for directory. The rest describe a files permission. (fig 1)
fig 1:
-rw-------. 1 root root 1253 Jul 22 17:19 file1
-rwxr-xr-x. 1 root root 100 Sep 2 20:02 file2
r=read
w=write
x=execute
After the first character, the next set of 3 positions represent the Users class. The following set of 3 represent the Group class and the last 3 set of characters represent the Others class.
fig 2:
Class Description
------ ---------------
user owner of file
group users who are members of files group
others users who are not owners or members of the group
To change permissions of each class, numbers are used to represent different types of permissions for the 3 different classes.
0 = no permissions
1 = execute only
2 = write only
3 = write and execute
4 = ready only
5 = read and execute
6 = read and write
7 = read, write, execute
The example below gives full permissions (read, write, execute) to the User class, and only read and execute permissions to both Group and Others class.
#chmod 755 filename.txt
**For more in-depth information about chmod refer to the man pages.
No comments:
Post a Comment