The
chmodcommand (abbreviated from ch ange mod e) is a shell command and C language function in Unix and Unix-like environments. When executed, it 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 mode file1To view what the permissions currently are, type:
$ ls -l fileCommand line 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
Octal numbers
The chmod command accepts three and four-digit octal numbers representing modes. Using a three-digit octal number to set the modes of a file named myfile :
$ chmod 664 myfile$ ls -l myfile-rw-rw-r-- 1 57 Jul 3 10:13 myfileSince the setuid , setgid and sticky bits are not set, this is equivalent to:
$ chmod 0664 myfileSymbolic modes
chmod also accepts symbolic notation, 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 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” but modifies only the permissions allowed by the umask. The references are represented by one or more of the following letters:
The chmod program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted:
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:
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.
Symbolic examples
Add the r ead and w rite permissions to the u ser and g roup classes of a directory:
$ chmod ug+rw mydir $ ls -ld mydirdrw-rw---- 2 unixguy uguys 96 Dec 8 12:53 mydirFor a file, remove w rite permissions for all classes:
$ chmod a-w myfile $ ls -l myfile-r-xr-xr-x 2 unixguy uguys 96 Dec 8 12:53 myfileSet the permissions for the user and the group to read and execute only (no write permission) on mydir .
$ chmod ug=rx mydir $ ls -ld mydird r-xr-x--- 2 unixguy uguys 96 Dec 8 12:53 mydir
Special modes
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.
Command line examples
Function details
For C programming language, the function prototype is defined:
int chmod(const char *path, mode_t mode);The function takes a parameter of type mode_t , which is a bitfield composed of various flags:
Where alternate flag names are given, one of the pair of names might not be supported on some OSs. The octal values of the flags are summed or combined in a bitwise or operation to give the desired permission mode.
Various error codes can be returned, and these are detailed in the associated man page for the function.
See also
- File system permissions
chown, the command used to change the owner of a file or directory on Unix-like systemschgrp, the command used to change the group of a file or directory on Unix-like systemscacls, 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
chmod(1): change file modes – FreeBSD General Commands Manualchmod— manual page from GNU coreutils.- GNU "Setting Permissions" manual
- Solaris 9 chmod man page
- Mac OS X chmod man page, which also supports access control lists.
- CHMOD-Win 3.0 — Freeware Windows' ACL ←→ CHMOD converter.
- What CHMOD? File Permissions Calculator, web-based CHMOD calculator.
- Beginners tutorial with on-line "live"
Folder Permissions - Windows Server Help
Folder Permissions, Windows Server Help, Windows 2000 // 2003, Exchange mail server & Windows 2000 // 2003 Server / Active Directory, backup, maintenance, problems ...
File and Folder Permissions
from Chapter 13, Microsoft Windows 2000 Administrator's Pocket Consultant by William R. Stanek. On NTFS volumes, you can set security permissions on files and folders.
Folder Permissions Reproting (For NTFS) - Smart-X
Folder Permissions Reproting (For NTFS) - Smart-X generates files and folders permissions report in a single mouse click!
folder permissions | RSJoomla!'s Joomla Extensions Blog
blogging about Joomla extensions - Viewing all posts. (folder permissions)
Folder permissions - MemHT Wiki
This page was last modified on 17 September 2008, at 17:54. This page has been accessed 3,099 times. Content is available under GNU Free Documentation License 1.2.
Folder Permissions Reporting (For NTFS) - Smart-X Enterprise Edition
Folder Permissions Reporting (For NTFS) - Smart-X Enterprise Edition auto generates and sends periodic files and folders permissions report!
Configuring Public Folder Permissions: Exchange 2007 Help
You can configure public folder permissions for both administrators of Microsoft Exchange Server 2007 or for users of client programs such as Microsoft Office ...
Folder Permissions | creativebits
I run a studio with five G5's (all running 10.4.2) networked to a G4 (10.2) runnning sharepoints for network volume mounts. My problem is that whenever a user creates a new folder ...
folder permissions - Flexera Software Community
folder permissions InstallShield 10.5 - Windows Installer Projects ... When i create my application, i need to create some files in the program folder.
Folder Permissions - Flexera Software Community
Folder Permissions InstallShield DevStudio 9 (Windows Installer projects) ... I am trying to set folder permissions on folders I am installing through my setup.