Difference between revisions of "Chmod"

From PGVWiki
Jump to navigation Jump to search
(brief leading sentance for chmod)
 
(No difference)

Latest revision as of 08:58, 3 January 2008

chmod is a Unix/Linux command that lets you tell the system how much (or little) access it should permit to a file.

Quick and Dirty

For files that need to be writable by everyone, i.e., config.php during installation/configuration, then use:

chmod 666 <file>

OR

chmod a+w <file>

For files that need to not be writable by everyone, i.e., pretty much every file after the initial configuration, then use:

chmod 644 <file>

OR

chmod a-w <file>

More detail

Installing the PhpGedView application in a UNIX-like operating system will require you to chmod several files. The chmod command changes the files and directories access modes. It allows for specific files to be readable, writable or executable for three groups of people: the file owner, the file group owner and everyone else.

Reading the output of the ls -l command will tell you the mode, or permissions, of a file. The output is a series of 7 characters which are most commonly: r, w and x. 'r' is read, 'w' is write and 'x' is eXecute. The groups are broken into three characters each and read left to right read, write, execute. Below is an example file that has read permissions for all three groups. Note: a '-' indicates no permission.

$ ls -l foo.txt
-rw-r--r--   1 bderr  bderr  0 Jan  2 17:04 foo.txt
$ chmod 666 foo.txt
$ ls -l foo.txt
-rw-rw-rw-   1 bderr  bderr  0 Jan  2 17:04 foo.txt

So for the first file above, the owner, bderr, can read and write to the file while the group, bderr, and everyone else can read the file but not write to it. No one has permission to execute the file. Next I ran the chmod utility and then listed the file again.

You may be wondering why there are 7 characters for the permissions but only 6 are used for the three permission groups. The initial character is used for specifying special permissions or characteristics of a file or directory. It will commonly be a 't' which indicates it is a 'sticky' file or directory. Do not worry about sticky bits for the purpse of installing and configuring PhpGedView. See the man page link at the bottom of this document for much more information about this powerful utility.

See Also

http://www.freebsd.org/cgi/man.cgi?chmod FreeBSD chmod man page