What is permission denied?

Overview

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.

Terminal


$ 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.

Terminal


$ 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.

Superuser

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 Cubby
What is Docker?
What is null? ]
What is java
What is Keycloak
What is maven?
What is Jackson?
What is Docker
What is self
What is ArgumentMatcher?
What is IM-Juggling?
What is params
What is SLF4J?
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
What is Java
What is centOS
What is RubyGem?
What is programming?
What is before_action?
What is Docker
What is Byte?
What is Tomcat
What is Maven Assembly?
What is `docker-compose up`?
What is a constructor?
What is vue cli
What is an interface?
What is Ruby's self?
What is hard coding?
What is a stream
What is Ruby's attr_accessor?
What is Java Encapsulation?
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What is object orientation?
What is Guava's @VisibleForTesting?
What is MVC model?
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?
[Swift] What is dismiss?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is JavaBeans?
[Android] What is Context? ??
[Java] What is ArrayList?
[Ruby] What is true?
What is object-oriented after all?
What is HttpSession session = request.getSession ();
What is docker run -it?
What is Java Assertion? Summary.