Last Edited: 01 May 2008 by superuser
Importered from old WiKi -- 30/04-08 17:04.

The chmod Command

http://www.linuxjournal.com/article/1190
http://www.mediacollege.com/linux/command/chmod.html
http://catcode.com/teachmod/
chmod is a Unix command that lets you tell the system how much (or little) access it should permit to a file.

The permissions are r Read w Write and x Execute, these enable you to protect a file by allowing people to only read a file and block them from changing it by disallowing them to write to it.

There are also some programs that should only be executed by the administrator or other programs in Linux these can be safeguarded by not allowing everyone to run them, this is where the x execute permission becomes valid.

To view and change permissions from the commandline use the two commands 'ls -l' list long and 'chmod' change mode.

Type in ls -l /(name of file or directory) this will give you the information about what permissions apply to the file or directory:

ls -l /root/gtkdiffrc

-rw-r--r-- 1 500 100 1099 Apr 25 1999 gtkdiffrc

this shows that the file gtkdiffrc has read and write permission -rw for the administrator read -r permission for groups and read -r permission for users. Note that Puppy runs in root which is the admin.

To change the permissions using chmod you can either use letters or numbers.

Letters denote the permissions and who they are applied to:

user, group and other are represented by u, g and o

Permissions are r, w, and x and are added or subtracted using the plus or minus sign i.e.

chmod u+w /name of file

Numbers can be used to represent the permissions and are, read = 4, write = 2 and execute = 1 so to give read only permission to the user and none to the group or others you would use:

chmod 400 /name of file

read, write and execute to all would be:

chmod 777 /name of file

Note that the user is the owner of the file and in Puppy that is usualy root.



CategoryApplicationPreinstalled