Users and permissions: confused about question 4

hi,
I’m a bit confused about the second question of second scenario:

Question link: Learn data science with Python and R projects

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

  • Question 3. Can dq modify the contents of this file?
  • Question 4. Can dq rename this file?

the answer to question 4 is yes, which is weird because as said in the lessen, the permission for rename needs to be set for the directory. if we don’t know the directory has w permission for others or not, how would we know from the file if we can rename it?

1 Like

Hi @a.harati1993:

This means that the minimum set of permissions on a directory to rename any file in it is -wx for the appropriate membership set (user/group/others).

your question is answered here. Also take a look at this thread.

Hope this helps and please remember to include a mission link in future!

1 Like

hi @masterryan.prof thanks for the reply, the thread and the lesson both say if w is set for the directory, we only need execute(x) permission for the file to be able to rename it, but the problem is we don’t know if the directory has the write permission set or not, we only know the permissions for the file and not the directory.
here’s the link of the lesson:
https://app.dataquest.io/m/387/users-and-permissions/8/the-superuser