Current time: 04-20-2014, 09:53 AM Hello There, Guest! (LoginRegister)

Post Reply 
Help Deleting files owned by user "nobody"?
08-05-2001, 05:46 AM
Post: #1
Help Deleting files owned by user "nobody"?
Hey all you *nix wizards out there! I feel *really stoopid* (er, uh shall we say embarrassed?) to send this one to tech support but my experimenting with PHP scripts (Yea! http://www.hotscripts.com) has left me with a little "dreamhost specific" problem.

Certain of my "test" installations have left files owned by "nobody" scattered in places within my directory tree. Granted, some of them were probably created *before* the move to DH2 and got moved "as they were found"(didn't DH1 run scripts as nobody?), but not all, and the way DH2 runs scripts as "youruser" complicates the problem:

I've found the common "nobody.cgi" and another script called "delete.pl" that let you manipulate (to varying degrees) "nobody's" files on your server (yep, even above your "public_html" dir!), but since DH2 runs your scripts as your user, they will not work for their intended purpose, which is to allow deletion of "nobody"'s files. Back to the same situation you have working from the command line in the shell.

Even stranger, after running a test installation of a PHP site management script called "administr8", I even found files created by the script that are owned by user "dhapache"...(This is a new one on me!) ..looks like I've got the same "unable to delete/edit/etc." problem with these puppies.

It *seems* that a user *ought* to be able to delete such files if they are in directories the user owns, but for the life of me I can't figure out how.

This is the third night I have dug around in all my *nix books till "zero_dark_thirty" in the morning trying to figure out a way to delete such files without pestering the sysadmin, but I'm whipped. I'm just not finding a way around this.

Digging around in the apache documentation even made it worse (kinda overloaded my brain) when I got to the su-exec stuff, and the various ways you can configure CGI access...at least I learned *a little*, and I think I have a better understanding of (and appreciation for) how/why DH does it the way they do....but I would still like to be able to kill such files without having to bus support whenever I am done with an installation.

Anybody have any suggestions?

Sheepishly,
rlparker
(address witheld out of sheepishness and shame - I'm really gonna feel silly if this turns out to be "really easy")
Find all posts by this user
Quote this message in a reply
08-06-2001, 02:18 PM
Post: #2
Help Deleting files owned by user "nobody"?
I don't want to tease you into think I have a solution here-- I don't. As a matter of fact, I have a similar problem...

I can't delete any of the log files from the test domains I create.

When I'm installing a new custom domain, I'll often set up a temporary newdomain.dreamhost.com subdomain so I can get started while DNS for the custom is propagatin'. Once I'm satisfied that everything's working, I copy the HTML/etc. over to the "real" directory. Then, when the "real" domain is fully operational and traffic is being pointed to it, I'm able to delete the temporary directory and DH subdomain.

Unfortunately, I can't seem to delete any of the subdomain's log files, even though I have no use for them... They're just taking up space in my account.

Anyone know how to deal with this?

TIA...

...Bob W.
Find all posts by this user
Quote this message in a reply
08-07-2001, 05:36 AM
Post: #3
Help Deleting files owned by user "nobody"?
Any files not owned by you will not eat up your disk quota. Only files owned by you will affect your quota. The system works on ownership rather than location of files.

However, you will need greated privilidges on your account than you already have if you want to remove these files. Therefore, you will need to contact customer support with a list of files you want deleted and they will be able to action it.

But if it doesn't bother you having old log files lying about, you can safely leave them there without them eating into your precious quota.

Wil
Find all posts by this user
Quote this message in a reply
08-07-2001, 01:32 PM
Post: #4
Help Deleting files owned by user "nobody"?
Interesting...

Thanks, Wil.

Too bad we have to bother the admins for such a mundane task, though. I really hate that.

BTW-- Do you work for DH? I'm trying to figure out the posters' labels that the board admin is using.

I thought "DH Dreamling" meant "staff", since Will (your doppelganger) had that title... but now he's "DH Familiar", so maybe it's just another totally obscure way of describing the user's number of posts. It'd be great if this was in the board's FAQ...

Regardless, I'd love it if all DH staff had a particular posting label, so's I can kin tell who's who...

...Bob W.
Find all posts by this user
Quote this message in a reply
08-07-2001, 10:48 PM
Post: #5
Help Deleting files owned by user "nobody"?
The Apache user is now 'dhapache' instead of 'nobody' but the stuff below applies to either situation....

If you own the directory, you can remove the files even if you don't own the file.

(as root)
windu# ls -al
total 8
drwxr-xr-x 2 william dhstaff 4096 Aug 7 22:36 ./
drwxr-x--x 8 william dhstaff 4096 Aug 7 22:37 ../
windu# touch bar
windu# chown dhapache:dhapache bar
(as me)
windu% cd foo
windu% rm bar
rm: remove write-protected file `bar'? y
windu% whoami
william

Thus if you create your directories (as you) before letting apache (PHP or whatever) write to it, you'll be able to remove the contents. If you create directories from the script, you won't be able to remove the contents of the directories as in this example (sorry for the boring filenames) unless the permissions are set so that the directory is world writable and executable (usually 0777). I think a directory has to be set this way a lot of times for Apache to write to it in the first place.

windu% ls -Ral
.:
total 12
drwxr-xr-x 3 william dhstaff 4096 Aug 7 22:39 ./
drwxr-x--x 8 william dhstaff 4096 Aug 7 22:40 ../
drwxr-xr-x 2 dhapache dhapache 4096 Aug 7 22:40 bar/

./bar:
total 8
drwxr-xr-x 2 dhapache dhapache 4096 Aug 7 22:40 ./
drwxr-xr-x 3 william dhstaff 4096 Aug 7 22:39 ../
-rw-r--r-- 1 dhapache dhapache 0 Aug 7 22:40 bar2
-rw-r--r-- 1 dhapache dhapache 0 Aug 7 22:40 bar3
-rw-r--r-- 1 dhapache dhapache 0 Aug 7 22:40 bar4
windu% rm -rf bar
rm: cannot unlink `bar/bar2': Permission denied
rm: cannot unlink `bar/bare': Permission denied
rm: cannot unlink `bar/bar3': Permission denied
rm: cannot remove directory `bar': Directory not empty

in this example, the directory ownerships are the same but we can remove the directory since it's world writable:

windu% ls -al
total 12
drwxr-xr-x 3 william dhstaff 4096 Aug 7 22:39 ./
drwxr-x--x 8 william dhstaff 4096 Aug 7 22:44 ../
drwxrwxrwx 2 dhapache dhapache 4096 Aug 7 22:40 bar/
windu% rm -rf bar
windu% ls
windu%

As a last resort, you can have support do it and they can do something like (as root, from your home directory):
find . -user dhapache -exec chown user:group {} \;
where user and group is your user and group.

You can use a similar trick if you have shell access and your directories are owned by you (to remove files you don't own).

find . -user dhapache -exec rm -f {} \;
Visit this user's website Find all posts by this user
Quote this message in a reply
08-07-2001, 10:50 PM
Post: #6
Help Deleting files owned by user "nobody"?
I think the status thing has to do with how many posts you've had. Someday I'll get Jeff to make me some sort of pimp title befitting my employee status, but until then I'll settle for being a 'familiar'.

Wil is not an employee; just a helpful guy. I am all too much an employee :>
Visit this user's website Find all posts by this user
Quote this message in a reply
08-07-2001, 10:55 PM
Post: #7
Help Deleting files owned by user "nobody"?
Yeah, UBB does the same thing... But IIRC, UBB also offers a way to signify admin types... Maybe WWWthreads does, too.

It'd be nice to know who staff is, since a lot of people post using a very authoritative tone, even though they don't work for DH.

...Bob

[Added later...]

Oops! Forgot to address the "pimp" aspect of your post...

Look, I really don't care what you do on your evening job!

*snicker*

...B.
Find all posts by this user
Quote this message in a reply
08-07-2001, 11:29 PM
Post: #8
Help Deleting files owned by user "nobody"?
Will...

Thanks for the info...

From what I can see, this means I can't use this trick to delete my directories, since you said that if we create the directories "from the script" (I take it you mean "via the Control Panel"), the directories can't be deleted this way.

Since, with log directories and files, the owner is root and the permissions are less than world writable, looks like I'll have to submit a supoport request.

The only ways I can see to avoid the creation of these pesky extra log files would be to wait around for DNS to propogate before testing a site with a custom domain... or to be satisfied with leaving a site in a subdomain-labeled directory (like domain.dreamhost.com)... Or, I suppose the simplest way would be to create a user first, then a directory that's named for the custom domain, then create the subdomain and point it to that directory while waiting for the custom domain to hit the nameservers.

[All of that actually brings up a little Catch-22 I bites me when I'm creating new accounts/domains/users... But I'll post about that separately.]

Then again, ya know what might keep the admins from having to step in? During the domain deletion process via the CP, maybe there could be a checkbox that says "Delete log files" (perhaps with a note about it that's added to the confirmation page that comes up during the process).

Hmmm...

...Bob
Find all posts by this user
Quote this message in a reply
08-08-2001, 12:59 AM
Post: #9
Help Deleting files owned by user "nobody"?
Actually the stuff I was talking about has nothing to do with log files; I was referring to files created by PHP scripts (which is what the original question is about).

If there are log files owned by you (ie not by root), let support know and they'll remove them. Since you don't own the logs directory (just files in it) you can't remove the files. This won't be the case unless you're saving extra days of logs. We will probably figure out some way to make this work better but it's not a high priority at the moment. We get very few requests of this nature, so it's easier just to change the permissions by hand when the problem crops up.

If the files are all owned by root, I'd say just don't worry about them.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-08-2001, 01:23 AM
Post: #10
Help Deleting files owned by user "nobody"?
Will jotted:

Quote:Actually the stuff I was talking about has nothing to do with log files; I
was referring to files created by PHP scripts (which is what the original
question is about).

Ah... I was confused because your reply threaded under my post (which dealt with log files), so I got a "Reply to your post" email.

Quote:If there are log files owned by you (ie not by root), let support know
and they'll remove them.

Okay... I'll send in a request.

Quote:Since you don't own the logs directory (just
files in it)
you can't remove the files. This won't be the case unless you're
saving extra days of logs. We will probably figure out some way to make
this work
better but it's not a high priority at the moment. We get very few
requests of this nature, so it's easier just to change the permissions by
hand when
the problem crops up.

If the files are all owned by root, I'd say just don't worry about them.

Okay... I *won't* send in a request. <g>

Anyway, I'm obviously being a pain in the ass, so I promise not to post again... at least for the next couple of minutes. <g>

...Bob
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: