Editing Chmod

Jump to navigation Jump to search

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.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{lowercase}}
 
 
[[wikipedia:chmod]] command is used to change the access permissions including special mode flags ([[sticky]]) of [[files]] and [[directories]]
 
[[wikipedia:chmod]] command is used to change the access permissions including special mode flags ([[sticky]]) of [[files]] and [[directories]]
 
 
* [[400]] user read only
 
* [[600]] user read and write only
 
* [[0644]]
 
  
 
== chmod examples ==
 
== chmod examples ==
Line 11: Line 5:
 
* <code>chmod a+x /path/to/file.txt</code>
 
* <code>chmod a+x /path/to/file.txt</code>
 
* <code>chmod og-r ~/.ssh/[[authorized_keys]]</code>
 
* <code>chmod og-r ~/.ssh/[[authorized_keys]]</code>
* <code> chmod og-rxw ~[[/.ssh/]]</code>
+
* <code> chmod og-rxw ~/.ssh</code>
  
 
<code>[[wikipedia:chmod|chmod]] ug+s /path/to/file.txt</code>
 
<code>[[wikipedia:chmod|chmod]] ug+s /path/to/file.txt</code>
 +
<pre>
 +
Before:
 +
ls -la file.txt
 +
-rwxr-xr-x  1 root        root    31 Nov 27 11:34 file.txt
  
Before:
+
stat file.txt
ls -la file.txt
+
   File: file.txt
-rwxr-xr-x   1 root        root    31 Nov 27 11:34 file.txt
+
  Size: 31        Blocks: 8          IO Block: 4096  regular file
+
Device: fd00h/64768d Inode: 13          Links: 1
[[stat]] file.txt
+
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)  Gid: (    0/    root)
  File: file.txt
+
Access: 2019-11-27 11:34:54.610196393 +0400
  Size: 31        Blocks: 8          IO Block: 4096  regular file
+
Modify: 2019-11-27 11:34:49.662193415 +0400
Device: fd00h/64768d Inode: 13          Links: 1
+
Change: 2019-11-27 11:34:49.666193418 +0400
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)  Gid: (    0/    root)
+
Birth: -
Access: 2019-11-27 11:34:54.610196393 +0400
+
 
Modify: 2019-11-27 11:34:49.662193415 +0400
+
chmod ug+s file.txt
Change: 2019-11-27 11:34:49.666193418 +0400
+
 
  Birth: -
+
After:
+
ls -la file.txt
chmod ug+s file.txt  
+
-rwsr-sr-x 1 root root 31 Nov 27 11:34 file.txt
 
After:
 
ls -la file.txt
 
-rwsr-sr-x 1 root root 31 Nov 27 11:34 file.txt  
 
  
<pre>
 
 
stat file.txt
 
stat file.txt
 
   File: file.txt
 
   File: file.txt
Line 49: Line 42:
 
== Related terms ==
 
== Related terms ==
 
* [[Sticky bit]]
 
* [[Sticky bit]]
* [[0644]]
 
* [[0600]]
 
* [[0755]]
 
* [[install -m]]
 
* [[Permissions are to open]]
 
  
 
== See also ==
 
== See also ==
* {{chmod}}
 
 
* {{UID}}
 
* {{UID}}
 
* {{Linux Commands privileges}}
 
* {{Linux Commands privileges}}

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Advertising: