[RAILS] [Linux] Easy commentary! How to check and change permissions

How to check permissions

Check the information of files and directories in the current directory with Linux commands.


$ls -l

#=>
-rw-r--r--1 user group 9 January 1 00:00 hoge.html.erb
drwxr-xr-x 6 user group 20480 January 1 00:00 download

How to read permissions

The first character indicates the file type. The 2nd to 4th characters indicate the authority to the owner of the file. The 5th to 7th characters indicate the authority to the owning group of the file. The 8th to 10th characters indicate the authority for others.

Classification of authority (range to be set)

Type meaning
- File
d directory
l Symbolic link

Basic type of authority

Read permission Write permission Execution authority
r w x

Scope of authority

Numerical value Authority Contents
0 --- No authority
1 --x Executable
2 -w- Writable
3 -wx Can be written and executed
4 r-- Readable
5 r-w Can be read and executed
6 rw- Readable and writable
7 rwx Can be read, written, and executed

-Example- -rw-r--r-- ↓ File type = file Owner = with read and write permissions Owned group = with read permission Other = with read permission

How to change access authority


$chmod mode Target file name

$ chmod 764 hoge.html.erb

Command options

argument Contents
-v Display command execution result
-c Display execution result only when there is a change
-R Change recursively

Recommended Posts

[Linux] Easy commentary! How to check and change permissions
[Easy] How to upgrade Ruby and bundler
How to check CircleCI code and automatically deploy to Heroku
[AWS] How to check logs
How to check JSF version
How to check the extension and size of uploaded files
How to use StringBurrer and Arrays.toString.
How to use EventBus3 and ThreadMode
[Rails] Easy way to check columns
[Rails] How to introduce kaminari with Slim and change the design
How to call classes and methods
How to change kube-proxy to ipvs mode.
How to use equality and equality (how to use equals)
How to connect Heroku and Sequel
How to convert LocalDate and Timestamp
How to change from HTML to Haml
How to change the maximum and maximum number of POST data in Spark
[Rails] How to create a table, add a column, and change the column type
How to check Java installed on Mac
How to change app name in rails
How to use OrientJS and OrientDB together
How to blur an image (super easy)
[Java] How to output and write files!
How to set up and use kapt
How to change the timezone on Ubuntu
How to build SquashTM and how to support Japanese
Ransack sort_link How to change the color!
How to find the tens and ones
How to use substring and substr methods
Note: [Docker] How to start and stop
How to write and explain Dockerfile, docker-compose
How to use @Builder and @NoArgsConstructor together
How to use ToolBar with super margin Part1 Set characters and change colors
JDBC promises and examples of how to write
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
How to output Excel and PDF using Excella
[Java] How to use FileReader class and BufferedReader class
[JavaFX] How to write Eclipse permissions in build.gradle
How to check the logs in the Docker container
How to execute and mock methods using JUnit
How to change Finder's default text editor to Atom
[Android] How to detect volume change (= volume button press)
[Ruby] How to use gsub method and sub method
How to play audio and music using javascript
How to make duplicate check logic more readable
How to use Segmented Control and points to note
Git and GitHub ~ How to fix common errors ~
How to set up and operate jEnv (Mac)
How to use scope and pass processing (Jakarta)
How to execute processing before and after docker-entrypoint.sh
http: // localhost: How to change the port number
How to find the total score and average score
[Rails] How to get success and error messages
How to build parquet-tools and merge Parquet files
Rails scope anti-patterns and how to eliminate them
Ruby How to convert between uppercase and lowercase
How to check Rails commands in the terminal
How to access Java Private methods and fields
[Java] How to use Calendar class and Date class
Do you really understand? How to check the library and license used by the app