Chmod


Chmod

The chmod command (abbreviated from change mode) is a shell command in Unix and 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 "file"

Options

The chmod command has a number of command line options that affect its behavior. The most common options are:
*-R: Changes the modes of directories and files recursively
*-v: Verbose mode; lists all files as they are being processed

tring 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:

$ chmod ["references"] ["operator"] ["modes"] "file1" ...

The references (or classes) are used to distinguish the users to whom the permissions apply. If no references are specified it defaults to "all". They are represented by one or more of the following letters:

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.

tring mode examples

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 $ ls -ld sample drw-rw---- 2 unixguy unixguy 96 Dec 8 12:53 sample

This command removes all permissions, allowing no one to read, write, or execute the file named sample.

$ chmod a-rwx sample $ ls -l sample ---------- 2 unixguy unixguy 96 Dec 8 12:53 sample

The following command changes the permissions for the user and the group to read and execute only (no write permission) on sample.

Sample file permissions before command $ ls -ld sample drw-rw---- 2 unixguy unixguy 96 Dec 8 12:53 sample $ chmod ug=rx sample $ ls -ld sample dr-xr-x--- 2 unixguy unixguy 96 Dec 8 12:53 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. Using a four-digit octal number to set the modes of a file or directory named sample would look something like this:

$ chmod 0664 sample

Assuming that the setuid, setgid and sticky bits are not set, this is equivalent to:

$ chmod 664 sample

or

$ chmod +r,-x,ug+w sample

pecial 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

ee also

*File system permissions
*chown, the command used to change the owner of a file or directory on Unix-like systems
*chgrp, the command used to change the group of a file or directory on Unix-like systems
*cacls, a command used on Windows NT and its derivatives to modify the access control lists associated with a file or directory
*User ID
*Group ID
*List of Unix programs

External links

*man|1|chmod|FreeBSD|change file modes
* [http://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html chmod] — manual page from GNU coreutils.
* [http://www.gnu.org/software/coreutils/manual/html_node/Setting-Permissions.html GNU "Setting Permissions" manual]
* [http://docs.sun.com/app/docs/doc/817-0689/6mgfkpckn?q=chmod&a=view Solaris 9 chmod man page]
* [http://www.hmug.org/man/1/chmod.php Mac OS X chmod man page] , which also supports access control lists.
* [http://neosmart.net/dl.php?id=4 CHMOD-Win 3.0] — Freeware Windows' ACL ←→ CHMOD converter.
* [http://www.classical-webdesigns.co.uk/resources/whatchmod.html What CHMOD? File Permissions Calculator] , web-based CHMOD calculator.
* [http://catcode.com/teachmod/index.html Beginners tutorial with on-line "live" example]


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Chmod — Capture d écran de la page de manuel en anglais de la commande chmod chmod (abréviation de change mode) est une commande Unix exécutable dans un environnement de type Unix qui permet de changer les permissions d accès (spéciales ou non) sur un… …   Wikipédia en Français

  • chmod — (abréviation de change mode) est un appel système d Unix ainsi que la commande correspondante qui permet de changer les permissions d accès d un fichier ou d un répertoire. Sommaire 1 Histoire 1.1 Permission de changer les droits …   Wikipédia en Français

  • Chmod — Saltar a navegación, búsqueda chmod ( change mode , cambiar modo en idioma inglés) es una llamada al sistema y su comando asociado en el sistema operativo UNIX (estandarizados en POSIX y otros estándares) que permite cambiar los permisos de… …   Wikipedia Español

  • Chmod — Тип программа для изменения прав доступа к файлам и директориям Разработчик Проект GNU Написана на C Операционная система Unix подобные Последняя версия 8.5 (23 апреля 2010) …   Википедия

  • chmod — ( change mode , cambiar modo en idioma inglés) es una llamada al sistema y su comando asociado en el sistema operativo UNIX (estandarizados en POSIX y otros estándares) que permite cambiar los permisos de acceso de un archivo o directorio.… …   Wikipedia Español

  • chmod — Тип программа для изменения прав доступа к файлам и директориям Разработчик Проект GNU Написана на C Операционная система Unix подобные Последняя версия 8.5 (23 апреля 2010) Лицензия …   Википедия

  • CHMOD — (von englisch: change mode) ist ein Kommandozeilenprogramm unter Unix, mit dem sich die klassischen Unix Dateiattribute (Zugriffsrechte) verändern lassen. Das chmod Kommando gibt es bereits seit der ersten Version des AT T Unix (Ende der 1970er… …   Deutsch Wikipedia

  • Chmod — (von englisch: change mode) ist ein Kommandozeilenprogramm unter Unix, mit dem sich die klassischen Unix Dateiattribute (Zugriffsrechte) verändern lassen. Das chmod Kommando gibt es bereits seit der ersten Version des AT T Unix (Ende der 1970er… …   Deutsch Wikipedia

  • chmod — chmod,   Befehl unter Linux für das Zuweisen von Lese , Schreib und Ausführungsrechten für eine Datei oder ein Verzeichnis.   Mit chmod lassen sich im Rahmen von dynamischen Webseiten die Zugriffsrechte von z. B. CGI oder PHP Dateien regeln …   Universal-Lexikon

  • chmod — The chmod command (abbreviated from change mode) is a Unix command that lets a user tell the system how much (or little) access it should permit to a file.[1] It changes the file system modes of files and directories. The modes include… …   Wikipedia