GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — chmod - Wikipedia
The command originated in AT&T Unix version 1 and was exclusive to Unix and Unix-like operating systems until it was ported to other operating systems such as Windows (in UnxUtils)[3] and IBM i.[4] In Unix and Unix-like operating systems, a system call with the same name as the command, chmod(), provides access to the underlying access control data. The command exposes the capabilities of the system call to a shell user. As the need for enhanced file-system permissions grew, access-control lists[5] were added to many file systems to augment the modes controlled via The implementation of UseAlthough the syntax of the command varies somewhat by implementation, it generally accepts either a single octal value (which specifies all the mode bits on each file), or a comma-delimited list of symbolic specifiers (which describes how to change the existing mode bits of each file). The remaining arguments are a list of paths to files to be modified.[7] Changing permissions is only allowed for the superuser (root) and the owner of a file. If a symbolic link is specified, the target of the link has its mode bits adjusted. Permissions directly associated with a symbolic link file system entry are typically not used. OptionsOptional, command-line options may include:
Octal notationGiven a numeric permissions argument, the There are twelve standard mode bits, comprising three special bits (setuid, setgid, and sticky), and three permission groups (controlling access by user, group, and other) of 3 bits each (read, write, and exec/scan); each permission bit grants access if set (1) or denies access if clear (0). As an octal digit represents a 3-bit value, the twelve mode bits can be represented as four octal digits. In the context of an octal digit, each operation bit represents a numeric value: read: 4, write: 2 and execute: 1. The following table relates octal digit values to a class operations value.
The command $ stat -c %a findPhoneNumbers.sh 754 The reported value,
A code permits execution if and only if it is odd (i.e. 1, 3, 5, or 7). A code permits read if and only if it is greater than or equal to 4 (i.e. 4, 5, 6, or 7). A code permits write if and only if it is 2, 3, 6, or 7. Symbolic notationThe Classes map permissions to users. A change specifier can select one class by including its symbol, multiple by including each class's symbol with no delimiter, or all classes by not specifying a symbol; when using the last method, the bits of the umask mask will remain unchanged.[10] Class specifiers include:
As ownership is key to access control, and since the symbolic specification uses the abbreviation o, some incorrectly think that it means owner, when, in fact, it is short for others. The change operators include:
Operations can be specified as follows:
Most The $ ls -l findPhoneNumbers.sh -rwxr-xr-- 1 dgerman staff 823 Dec 16 15:03 findPhoneNumbers.sh The permission specifier ExamplesAdd write permission to the group class of a directory, allowing users in the same group to add files: $ ls -ld dir # before drwxr-xr-x 2 jsmitt northregion 96 Apr 8 12:53 shared_dir $ chmod g+w dir $ ls -ld dir # after drwxrwxr-x 2 jsmitt northregion 96 Apr 8 12:53 shared_dir Remove write permission for all classes, preventing anyone from writing to the file: $ ls -l ourBestReferenceFile -rw-rw-r-- 2 tmiller northregion 96 Apr 8 12:53 ourBestReferenceFile $ chmod a-w ourBestReferenceFile $ ls -l ourBestReferenceFile -r--r--r-- 2 tmiller northregion 96 Apr 8 12:53 ourBestReferenceFile Set the permissions for the user and group classes to read- and execute-only, with no write permission, preventing anyone from adding files: $ ls -ld referenceLib drwxr----- 2 ebowman northregion 96 Apr 8 12:53 referenceLib $ chmod ug=rx referenceLib $ ls -ld referenceLib dr-xr-x--- 2 ebowman northregion 96 Apr 8 12:53 referenceLib Enable read and write for the user class while making it read-only for group and others: $ chmod u=rw,go=r sample $ ls -ld sample drw-r--r-- 2 oschultz warehousing 96 Dec 8 12:53 sample
See also
Notes
References
External linksThe Wikibook Guide to Unix has a page on the topic of: Commands
Retrieved from "https://en.wikipedia.org/w/index.php?title=Chmod&oldid=1384199862" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||