Difference between revisions of "Chmod"
Jump to navigation
Jump to search
(18 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{lowercase}} |
− | [[wikipedia:chmod]] | + | [[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 == | ||
− | + | * <code>chmod a+x /path/to/file.txt</code> | |
+ | * <code>chmod og-r ~/.ssh/[[authorized_keys]]</code> | ||
+ | * <code> chmod og-rxw ~[[/.ssh/]]</code> | ||
+ | |||
+ | <code>[[wikipedia:chmod|chmod]] ug+s /path/to/file.txt</code> | ||
+ | |||
+ | Before: | ||
+ | ls -la file.txt | ||
+ | -rwxr-xr-x 1 root root 31 Nov 27 11:34 file.txt | ||
− | + | [[stat]] file.txt | |
+ | File: file.txt | ||
+ | Size: 31 Blocks: 8 IO Block: 4096 regular file | ||
+ | Device: fd00h/64768d Inode: 13 Links: 1 | ||
+ | Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) | ||
+ | Access: 2019-11-27 11:34:54.610196393 +0400 | ||
+ | Modify: 2019-11-27 11:34:49.662193415 +0400 | ||
+ | Change: 2019-11-27 11:34:49.666193418 +0400 | ||
+ | Birth: - | ||
− | chmod | + | chmod ug+s file.txt |
+ | |||
+ | After: | ||
+ | ls -la file.txt | ||
+ | -rwsr-sr-x 1 root root 31 Nov 27 11:34 file.txt | ||
− | |||
<pre> | <pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
stat file.txt | stat file.txt | ||
File: file.txt | File: file.txt | ||
Line 44: | Line 46: | ||
Birth: - | Birth: - | ||
</pre> | </pre> | ||
+ | |||
+ | == Related terms == | ||
+ | * [[Sticky bit]] | ||
+ | * [[0644]] | ||
+ | * [[0600]] | ||
+ | * [[0755]] | ||
+ | * [[install -m]] | ||
+ | * [[Permissions are to open]] | ||
== See also == | == See also == | ||
+ | * {{chmod}} | ||
+ | * {{UID}} | ||
* {{Linux Commands privileges}} | * {{Linux Commands privileges}} | ||
− | + | * {{files}} | |
[[Category:Linux commands]] | [[Category:Linux commands]] |
Latest revision as of 19:06, 28 February 2023
wikipedia:chmod command is used to change the access permissions including special mode flags (sticky) of files and directories
chmod examples[edit]
chmod a+x /path/to/file.txt
chmod og-r ~/.ssh/authorized_keys
chmod og-rxw ~/.ssh/
chmod ug+s /path/to/file.txt
Before: ls -la file.txt -rwxr-xr-x 1 root root 31 Nov 27 11:34 file.txt stat file.txt File: file.txt Size: 31 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 13 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-11-27 11:34:54.610196393 +0400 Modify: 2019-11-27 11:34:49.662193415 +0400 Change: 2019-11-27 11:34:49.666193418 +0400 Birth: - chmod ug+s file.txt After: ls -la file.txt -rwsr-sr-x 1 root root 31 Nov 27 11:34 file.txt
stat file.txt File: file.txt Size: 31 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 13 Links: 1 Access: (6755/-rwsr-sr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-11-27 11:34:54.610196393 +0400 Modify: 2019-11-27 11:34:49.662193415 +0400 Change: 2019-11-27 12:11:20.637362248 +0400 Birth: -
Related terms[edit]
See also[edit]
chmod: 400, 0600, 0644
- UID, GID,
id
,chown
,chgrp
,chmod
,groups
, sticky bit,stat
, User ID,USER
sudo
,id
,visudo
,useradd
,userdel
,usermod
,groups
,passwd
,chown
,chmod
,chgrp
,groupadd
,groupdel
, Passwordless sudo, passwd (package),sudo --help
- file, File system, directory,
touch
,mkdir
,ls
,ln
truncate
,fallocate
,split
,stat
, inode, File descriptor, superblock, block size (blockdev
),fuser
,lsof
,scrub
,chattr
, ulimit (nofiles),cp
,mv
,file (command)
,mkfifo
,chmod
Advertising: