Try to become root (sudo su -
) and then access the contents of the file/folder.
Using sudo
elevates your permissions only temporarily.
If you are not a member of a group that has execute permissions on a directory you will [not] be allowed to enter that directory. Below, I have removed the execute bit from the permissions of group wheel, of which this user is a member. (previously drwxr-xr-x
)
drwxr--r-x 2 root wheel 128 Sep 1 18:48 zfs
[user@host /etc]$ sudo cd zfs
[user@host /etc]$
I am able to execute the command sudo cd zfs
and it runs fine. But when the command completes I find that my working path is not inside the zfs directory.
Verify the permissions of the directory that you are attempting to enter. The user or member of the group must have the execute permission.
sudo
, like shell parentheses, pipeline (usually) or script or many other tools likeenv nohup parallel
, runs a command you give it in a subshell. Any change made in a subshell does not affect the parent shell. Changing the working directory olf a subshell does not affect the parent. Setting an env var (like PATH) in a subshell does not affect the parent. Setting a shell option in a subshell does not affect the parent. Setting aulimit
in a subshell does not affect the parent. Etc, etc, etc. – dave_thompson_085 Sep 7 '16 at 11:04