[Gllug] Root doesn't have permission

Dave Cridland dave at cridland.net
Sun Mar 3 11:14:23 UTC 2002


On Sun, 2002-03-03 at 00:46, Mike Brodbelt wrote:
> On Sun, 2002-03-03 at 00:29, Roger Whittaker wrote:
> > Definitely not nfs mounted, and nothing relevant in /var/log/messages that
> > I can see.
> > 
> 
> The normal thing that I've seen cause root to get permission denied
> errors from ls is directories with messed up permissions. The ls -l
> command attempts to descend into directories to list their contents, and
> if there are directories present which do not have the executable bits
> set on them, you'll throw up a permission denied when ls tries to
> descend into them.
> 
> Try "file *" which should show you whether they are directories, and if
> so, you should be able to chmod +x them.

stat(1) might help, too. It looks like you're getting a fail on the
stat(2) call, although opendir(3)/readdir(3) are working fine.

However, I suspect a dodgy filesystem.

Getting permission denied for root is perfectly common, as Mike says,
for things that don't have execute permission bits set at all, but I've
not seen that on ls. Look at:

# Create and setup.
mkdir /tmp/perm-test
pushd /tmp/perm-test
# Actual tests:
mkdir Is-a-directory
./Is-a-directory ## Gives "Is a directory" (exec)
touch Perm-Denied ## Create a non-executable file.
./Perm-Denied ## Gives permission denied, even for root. (exec)
chmod 0 Is-a-directory ## Remove any permissions.
ls -l Is-a-directory ## Gives no error on my system.
ls -l ## Gives no error on my system
# Cleanup
popd
rm -rf /tmp/perm-test

Run those one-by-one in the shell, and look at the errors it gives you.

I *have* seen such errors as you're getting when filesystems corrupt,
leaving the file type bits set to zero, or when the inode vanishes from
under the directory entry. Both I've only seen when hard disks have
started randomly failing. I'd recommend a thorough fsck - "e2fsck -cfy"
if you're running ext[23], and check for bad blocks as well.

If I'm right in thinking it's an inode corruption/vanishing problem,
then I'd expect you'd also be unable to use "cat" or "stat" on it.

Dave.


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list