bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in "du", needing current directory


From: John F Meinel Jr
Subject: Bug in "du", needing current directory
Date: Thu, 22 May 2003 15:02:41 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826

I found an odd bug in using du

Specifically, why does du need to read the current directory if you are wanting the disk usage of a different directory. I ran into this problem because I have a cron job that switches to another user, and then runs du in order to do some monitoring. Whenever I ran this job as root manually, it worked fine, but when I ran it as cron I got the error:

du: cannot open current directory: Permission denied

I eventually figured out that cron was running the process in '/root' , which didn't have read permissions set for the user that the process was switching to.

It is simple to reproduce this. Create a directory as root and then chmod it 700. Switch to that directory and then su to another use (therefore you don't have permission to read the current directory) type du /etc (or some other directory you normally can access), and you should get this error.

My workaround was to give read permissions to /root, but that really isn't a preferred method.

# du --version
du (fileutils) 4.1.9
Written by Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]