Opentopia Directory Encyclopedia Tools

Chmod

Encyclopedia : C : CH : CHM : Chmod


The correct title of this } is }}}. The initial letter is capitalized due to [Naming conventions #Lower case first lettertechnical restrictions].
The chmod command (abbreviated from change mode) is a shell command in Unix-like environments.

When executed, the command can change file system modes of files and directories. The modes include permissions and special modes.

History

A chmod command first appeared in AT&T UNIX version 1, and is still used today on UNIX-like machines.

Usage

The chmod command options are specified like this:

$ chmod [options] mode file1 ...
To view what the permissions currently are type:
$ ls -l

Options

The chmod command has a number of command line options that affect its behavior. The most common options are:

String modes

See also: Symbolic notation of file system permissions
To the chmod utility, all permissions and special modes are represented by its mode parameter. One way to adjust the mode of files or directories is to specify a symbolic mode. The symbolic mode is composed of three components, which are combined to form a single string of text:

classes operator modes
The classes are used to distinguish the users to whom the permissions apply. They are represented by one or more of the following letters:

The modes indicate which permissions are to be granted or taken away from the specified classes. There are three basic modes which correspond to the basic permissions:

Finally, the chmod program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted: The combination of these three components produces a string that is understood by the chmod command. Multiple changes can be specified by separating multiple symbolic modes with commas.

For example, the following command would be used to add the read and write permissions to the user and group classes of a file or directory named sample:

$ chmod ug+rw sample

Octal numbers

See also: Octal notation of file system permissions
The chmod command also accepts three- and four-digit octal numbers representing modes. See the article mentioned above for more information about octal notation.

An example of the chmod command using a four-digit octal number to set the modes of a file or directory named sample:

$ chmod 0664 sample

Special modes

See also: Additional file system permissions
The chmod command is also capable of changing the additional permissions or special modes of a file or directory. The symbolic modes use s to represent the setuid and setgid modes, and t to represent the sticky mode. The modes are only applied to the appropriate classes, regardless of whether or not other classes are specified.

Most operating systems support the specification of special modes using octal modes, but some do not. On these systems, only the symbolic modes can be used.

Examples

See also

External links

Unix command line programs[ view][ talk][ edit] )
File and file system management: cat | chdir/cd | chmod | chown | chgrp | cp | du | df | fdupes | file | fsck | ln | ls | lsof | mkdir | more | mount | mv | pwd | rcp | rm | rmdir | split | touch | tree
Process management: anacron | at | chroot | cron/crontab | kill | nice | ps | sleep | time | timex | top | renice | wait
User Management/Environment: env | finger | id | locale | mesg | passwd | su | sudo | uname | uptime | w | who | write
Text processing: awk | cut | diff | ex | head | iconv | join | less | more | nkf | paste | sed | sort | tail | tr | uniq | wc | xargs
Shell programming: echo | expr | unset Printing: lp
Communications:
inetd | netstat | ping | rlogin | traceroute
Searching:
egrep | fgrep | find | grep | strings
Miscellaneous:
banner | bc | cal | man | uname | wall | yes

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: