Originally Posted by grayFalcon
I've got a funny problem: I have some files lying around in /root/bla/, all these files are 644 and /root/bla/ is 755. Still, when I try (as a different user) to cp /root/bla/file ., I get a "cp: cannot stat: Permission denied". I also cannot ls /root/bla/, I also get a Permission denied... what gives?
Thanks a lot in advance,
The explanation is easy -- you don't have the permissions set as you describe.
1. If the directory permissions are 755 (rwxr-xr-x) including all parent directories
, anyone can list the directory contents. But you can't, so the full directory path
doesn't have 755 permissions.
2. If the files are 644 (rw-r--r--), then you can read them. But you can't, so either the files don't have 644 permissions. or requirement (1) above is not met
To clarify -- if the entire
path isn't listable by your user, you will get the result you got. So any parent directory without the execute bit set for your user will make it and all subdirectories unlistable. And files in the subdirectories will be unreadable.
So to read any particular file in a path, and to get directory listing for the path, the entire
path must be parseable by your user.
If as root you see that a particular subdirectory is set to 755, this isn't enough to assure that a user will be able to list or read files in that directory. For that, all the parent directories must be readable by your user as well.
Now. Think about the fact that you are in the /root directory. Why would the root user open his home directory for anyone to browse?
On my system, the /root directory has drwxr-x---
permissions. Meaning? Ordinary users cannot browse or read that directory or any subdirectories. Members of the root group can browse and read files, but ordinary users cannot.