There is a directory 'dir1' owned by root:root. Stat shows:
Access: (0750/drwxr-x---) Uid: ( 0/ root) Gid: ( 0/ root)and when I log in as root my id shows:
uid=0(root) gid=0(root) groups=0(root)however when I try to cd into that directory I get:
-bash: cd: dir1/: Permission deniedany ideas why this might be happening and how to remedy it?
53 Answers
Maybe it's SELinux?
Try check with
ls -ladZ dir1or try to disable SELinux temporary
setenforce 0
# To emable "setenforce 1" Is the directory in question hosted on NFS? If so, you might find that root:root is mapped to a safer user (e.g. nobody:guest) on the server.
If you have access to the server, and want remote users to have root privilege, you'll want to add the no_root_squash option to the relevant export in /etc/exports. I strongly urge you to read the documentation before doing so.
The directory does not have execute permission, which controls listing its content and entering it. First chmod +x and then cd into it.
Another possibility could be use of ACL. It can sometimes produce weird errors. Try cat /etc/fstab | grep acl and if it is there, try getfacl dir1.