What is permission denied?


Today, I was worried about the permission denied problem while learning about automatic deployment, and I felt that I had little knowledge of authority systems, so I investigated it in detail as a review.

"Permission" means "permission or authority" in English, and "denied" means "denied in the past form of denial". In other words, permission denied means something like" you are not authorized ". And, the permission in programming is set with the information that defines the authority "who is allowed what kind of operation". This information is called permissions.

How to check permissions?

Run the ls command with the-l option. Then, I think that the screen looks like this.


$ ls -l 
drwxr-xr-x. 20 root  root  2077 July  5 14:34 bin/cat

"D" refers to a directory, rwx stands for r (read), w (write), and x (execute), and from the left, "owner," "group user," and "other user." Therefore, it is displayed as "rwxr-xr-x".

How to change permissions?

Specify the chmod command. chmod is read as "change mode". The format is as follows. chmod <8-ary number> <filename>

meaning Numbers
reading(r) 4
writing(w) 2
Run(x) 1

As an example, you can change the permissions by entering the command as follows. In this case, the part of chmod 755 file.txt on the second line is hit.


$ ls -l file.txt
-rw-r--r--  1 takuya  staff  0 Jul 12 18:58 file.txt

$ chmod 755 file.txt

$ ls -l file.txt
-rwxr-xr-x  1 takuya  staff  0 Jul 12 18:58 file.txt*

In other words, "755" is "7 (4 + 2 + 1) 5 (4 + 1) 5 (4 + 1)", giving permissions to all users and "reading" to groups and their users. "And" execute "is given.


A superuser is a user with strong privileges who is allowed to perform all kinds of operations. Also known as the "root user" because the username is root. A superuser is a highly authorized user who is allowed to perform all operations and can change configuration files and install new applications, but it is usually risky because of the strong authority. It is important to log in as a general user, operate it, and work as a superuser only when necessary. There are su command and sudo command as commands, but the difference is that after executing the su command, you need to exit the superuser state with the ʻexit command. Also, the sudo command executes commands on behalf of the root user, while the su command` allows the root user to operate on behalf of the root user, so the root user password is required. I will.

Recommended Posts

What is permission denied?
What is params
What is SLF4J?
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
What is RubyGem?
What is Byte?
What is Tomcat
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What is object orientation?
What is an annotation?
What is Java technology?
What is Java API-java
What is @ (instance variable)?
What is Gradle's Artifact?
What is JPA Auditing?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is ArrayList?
What is object-oriented after all?
What is a jar file?
What exactly is an API?
What is a Java collection?
What is a lambda expression?
[Ruby] What is `!!` used for?
[Java] What is jaee j2ee?
[Java] What is class inheritance?
What is the constructor for?
Introduction to Ratpack (1) --What is Ratpack?
What is a fa⁉ enum?
[Java basics] What is Class?
What is java escape analysis?
What is Microservices? And Microservices Frameworks
What is Rails Active Record?
What is the initialize method?
What is thread safe (with Java)
What is a column Boolean type?
What is it? ~ 3 types of "no" ~
What is a reference type variable?
What is @Autowired in Spring boot?
[Technical Note] What is Object Oriented?
[Folio LSP] What is Okapi-Stripes Platform?
What is a lambda expression (Java)
What kind of method is define_method?
What is a Ruby 2D array?
What is the best file reading (Java)
What is a class in Java language (1 /?)
[For super super beginners] What is object orientation?
What is Java and Development Environment (MAC)
What is a class in Java language (2 /?)
What is the model test code testing
What is the main method in Java?
What is the data structure of ActionText?
What is the Facade pattern useful for?
What is RSA signature verification and why?