≡ Menu

CHMOD: What is it?

How do you use CHMOD?

There are many commands in UNIX; one of the commands is called chmod. Chmod is use for changing file permissions, but first you should find out how to check the permissions by using the command ls -l, which means give me a long listing. It is very detailed. When you use ls -l command it will show you seven things and out of the seven is the file permissions. The file permissions look like this: “drwxrwxrwx”. The permissions are divided into four categories. The character d means if the file is a directory. The next three characters belong to the owner, then the owner?s groups, and lastly is the; everyone group. The character r stands for read, which gives the user to open and read the file. The character w stands for write, which allows the user to write to the file, and the character x stands for execute which lets the user to execute the file.

There is two ways to change the permissions in UNIX. One of the ways is absolute meaning numeric. The second way is symbolic, using special symbols to add and remove the permissions. The absolute uses numbers to change the permissions. The number 0 sets no permissions, 1 sets the execute, 2 sets the write, and 4 sets the read permission. The first thing you need is the name of the file. Adding the permissions is a easy task. Let?s say you need full access, all you would need to do is add all permissions numbers. For example 1+2+4 is equal to 7. When using the command you need to set three groups of numbers. First group is for the owner, the second is for the owners group, and the third is for everyone. Here?s another example if you need the owner to have full access and the group with read and write only, you would type “chmod 760 filename“.

Relative is another way to use chmod, but you will need to know the existing permissions by using ls -l. When you know the existing permissions of a file or directory; all you need to know is that u means the owner, g means the owners group, and o is everybody. The way you would use this is “chmod u+w,g-x,o-rwx filename”. By doing this will set the owner to write to the file, will not let the owner’s group to execute the file, and don’t let anyone to do anything to the file. Except the people who has been given the rights too.

Works Cited

Eisenberg Dave, "chmod Tutorial"; http://catcode.com
    updated: 18 October 2004, Retrieved:  November 13, 2004

{ 0 comments… add one }

Leave a Reply