Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Chmod
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Examples== <!-- Please keep meaningful names and use examples that someone might want. DGerman And remember: less is more. KISS --> Add '''w'''rite permission to the '''g'''roup class of a directory, allowing users in the same group to add files: <syntaxhighlight lang="console" highlight="3"> $ 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 </syntaxhighlight> Remove '''w'''rite permission for '''a'''ll classes, preventing anyone from writing to the file: <syntaxhighlight lang="console" highlight="3"> $ 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 </syntaxhighlight> Set the permissions for the '''u'''ser and '''g'''roup classes to '''r'''ead and e'''x'''ecute only; no '''w'''rite permission; preventing anyone from adding files: <syntaxhighlight lang="console" highlight="3"> $ 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 </syntaxhighlight> Enable '''w'''rite for the '''u'''ser class while making it '''r'''ead-only for '''g'''roup and others: <syntaxhighlight lang="console"> $ chmod u=rw,go=r sample $ ls -ld sample drw-r--r-- 2 oschultz warehousing 96 Dec 8 12:53 sample </syntaxhighlight> To recursively set access for the directory '''docs/''' and its contained files: <code>chmod -R u+w docs/</code> To set user and group for read and write only and set others for read only: <code>chmod 664 file</code> To set user for read, write, and execute only and group and others for read only: <code>chmod 744 file</code> To set the sticky bit in addition to user, group and others permissions: <code>chmod 1755 file</code> To set UID in addition to user, group and others permissions: <code>chmod 4755 file</code> To set GID in addition to user, group and others permissions: <code>chmod 2755 file</code>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)