Adjust file permissions with the Linux command chmod

Introduction

Check permissions

Check the file permissions with the ls command.

$ ls -l

Meaning of permissions

Something like drwxr-xr-x represents the permission settings.

Alphabet meaning
d directory
r Read
w Writing
x Run
- Disallowed

The leading d indicates that it is a directory. The rest represents three patterns of permissions: owner, group user, and other users. drwxr-xr-x will be in the following state.

Owner (u) Group user (g) Other users (o)
d rwx r-x r-x
Directory Permission to read, write, and execute Read, execute permission, write disallow Read, execute permission, write disallow

Permission numbers

To express rwx as an octal number, it is as follows. 0 means no permission, 1 means permission.

rwx 8 base
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

If you want to allow the operation only to the owner rwx ------ becomes 111000000 and becomes 700.

How to use

Operate with plus and minus

Give the owner write permission to the specified file

$ chmod u+w test.txt

Remove the execute permission of the owner of the specified file

$ chmod u-x test.txt

Specify all by numbers

Or specify them all in octal numbers

$ chmod 700 test.txt

Recommended Posts

Adjust file permissions with the Linux command chmod
Try rewriting the file with the less command
Replace the directory name and the file name in the directory together with a Linux command.
Linux command [File operation]
[Linux] Execute git pull regularly with the crontab command
Linux file and directory permissions
Check the memory status of the server with the Linux free command
Check the operating status of the server with the Linux top command
Extract the xz file with python
Follow the file hierarchy with fts
[Linux] OS recovery with restore command
[linux] kill command to kill the process
Download the file deployed with appcfg.py
Using cgo with the go command
Hit the top command with htop
Open the file with the default app
Check the HTTP status code response with the curl command (#Linux #Shell)
How to make a command to read the configuration file with pyramid
Check server I / O device usage with the Linux iostat command
How to output the output result of the Linux man command to a file
"Chmod" command to set file and folder permissions and access permissions (setting values)
Linux command # 4
Linux command # 3
Adjust the spacing between figures with Matplotlib
Check the existence of the file with python
[Linux] How to use the echo command
How to use the Linux grep command
Let's read the RINEX file with Python ①
Linux permissions
Notify Slack when the linux command finishes
Linux command # 5
The --security option cannot be used with the dnf command on CentOS Linux
Check the file size with du -sh *
Download the file with PHP [Under construction]
Zip-compress any file with the [shell] command to create a file and delete the original file.
Linux: Rename the process displayed by the ps command
Linux: Understand the information displayed by the top command
Compress with zip command of java side linux
Save the object to a file with pickle
It's a Mac. What is the Linux command Linux?
Get the latest Linux kernel version with Arch Linux
What! The unzipped file name was SJIS! command?
Load the TensorFlow model file .pb with readNetFromTensorflow ().
Convert the character code of the file with Python3
Linux command list
[Linux] Search command
Linux command <Basic 2>
Linux [directory command]
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
[Linux] Command / Knowledge
My linux command
[Linux] File search
Linux command <Basic 1>
Linux command collection
Linux mkdir command
Adjust Linux swapability