File Permission in Command Line

I am working on the File Permission in command line


Second scenario: User learn owns a file whose permissions are rwxr-xr-x .

  • Question 3: Can dq modify the contents of this file? Answer is No
  • Question 4: Can dq rename this file? Answer is Yes

Does anyone know why the answer is Yes for question 4?
If dq cannot modify the file, how come dq can rename it? Is the answer correct for question 4?


1 Like


Modifying the contents of a file and renaming it are two different types of modification. Take a look at the table in the linked screen, specifically at the highlighted part:

I hope this helps.


hi @Bruno, thank you very much!

I find this confusing. I though you had to have both w and x for this to hold.
learn owns a file whose permissions are rwxr-xr-x; there’s no w here for others. What am I doing wrong? :face_with_monocle:

I don’t understand your question. There are five questions, which one are you talking about?

Question 4. I don’t understand why the answer is Y. I don’t understand your explanation in the thread above.

1 Like

Renaming a file doesn’t count as modifying it here. In this context, the file means modifying its contents.

Does this answer your question?

None of this makes sense. I have no idea what you are referring to. Can you please show the exact file access modes (as far as that is possible) you are talking about for each of the files/directories in question?

One of the givens is that all files mentioned are in /home/dq.

Running ls -hl .. from /home/dq shows us that dq owns this directory and user dq has all permissions on it.

/home/dq$ ls -hl ..                                                             
total 8.0K                                                                      
drwxr-xr-x 1 dq dq 4.0K May 12 15:33 dq

In the scenario set in question 4, there’s a file (in /home/dq) that learn owns.

The question asks if dq can rename this file. The ability to rename files is given by the directory’s permissions (i.e. /home/dq's permissions). The user dq has all permissions in this directory, including modification privileges, as given by w.

Now please refer to the underlined bit in the screenshot above.


Now it all makes sense! Thank you very much!

1 Like

I’m glad it helped. I’m curious to know if there was any specific piece of the puzzle that was missing for you, or if you really needed an overall explanation.

1 Like

I had not realized that I was supposed to look at the dq file access modes. Your explanation helped me understand that I need to take a step back and check all the relevant file access mode definitions. In other words, I was just hyper focused on rwxr-xr-x and tried to answer everything by just looking at this particular piece of information. I hope this clarifies it. Thanks again! :blush:


This is super helpful! Also thanks to berina.suljic


Hello, Could you please help me understand how the answer for the below question is y?

Below question says that user dq can’t enter /home/learn. It implies that user dq doesn’t have execute permission on /home/learn. It doesn’t say whether user dq has read permission or not, correct ? So, do we just assume that user dq doesn’t have read permission on /home/learn and so cannot read/list contents of /home/learn ?

Could you tell me if I am able to utilize the assumptions given to the fullest to answer the questions?

Assumption 1 says that all directories in the path /home/dq have execution permissions for all users. It means that all users can enter the /home/dq directory. Until and unless we run ls -hl command in the CLI, it is not evident that all users have read permissions as well, correct ? or Is it safe to assume that user has read and execute permissions when someone says user has execution permissions?

Assumption 3 says Group ownership is the same as user ownership. How does this help in answering questions?

Please let me know. Thank you.

Can you please ask this in a separate topic? It’s not the same question as the topic you’re posting on, so it should be in a new topic.

While you’re at it, can you also please clarify what you mean with the answer being y? It is not.

Please ask this in a new topic, it’s not related to the question being discussed in this topic.

What does owning of file means?
Does it means the accessing of file from /home/learn or it means that the copy of file from /home/dq in /learn?

Please ask this in a new topic, it’s not related to the question being discussed in this topic.