Help with stubborn directory

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,741
Location
USA
In my attempt to create a web based backup system, I've managed to create a directory on this host that I am unable to do anything with. Some how the script I ran set the permissions to the backup directory as follows:

bash-2.04$ ls -al
total 12
drwxrwxrwx 3 handruin handruin 4096 Jun 2 02:27 .
drwxr-xr-x 26 handruin handruin 4096 Jun 2 02:01 ..
drwx------ 2 nobody nobody 4096 Jun 2 02:19 20020602-0219
bash-2.04$

The listing in red cannot be deleted by me. I've tried to chown, chgrp, chmod, but nothing seems to work. Is it possible for a script to create a directory so that I don't have permission to access it at all?

Anyone know how to get rid of this? (without having to contact the site admin) This is in Red hat linux through a SSH terminal. I don't have direct access to this host.
 

Tea

Storage? I am Storage!
Joined
Jan 15, 2002
Messages
3,749
Location
27a No Fixed Address, Oz.
Website
www.redhill.net.au
I have an equally stubborn, and equally empty, directory on my web server. I made it in the usual way, I think - i.e., using one or another of the various FTP packages I use, but I can't delete it even when I dust off Tannin's very rusty skills and telnet in.
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
Handruin, I'm not sure what you're having trouble with.

As root, you should be able to do whatever you want with that directory. You say you've tried a whole bunch of commands to modify it - what exactly happened when you tried them? Did you get an error message or what?

I tried this as a test:

[user@XJDFAU temp] /bin/su
Password:
[root@XJDFAU temp] mkdir 20020602-0219
[root@XJDFAU temp] ls -ld 20020602-0219
drxw------ 2 root root 4096 Jun 2 11:58 20020602-0219/
[root@XJDFAU temp] chown nobody 20020602-0219
[root@XJDFAU temp] chgrp nobody 20020602-0219
[root@XJDFAU temp] ls -ld 20020602-0219
drxw------ 2 nobody nobody 4096 Jun 2 11:58 20020602-0219/

That's exactly the same directory as you have, right?

[root@XJDFAU temp] rm -rf 20020602-0219
[root@XJDFAU temp] ls -ld 20020602-02119
ls: 20020602-02119: No such file or directory

So what's the problem?
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
(Ignore the superfluous "1" on those last two lines.)
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,741
Location
USA
This directory is on storageforums host. I do not have root permissions so I can't go and and blow it away. When I try to delete it, I receive a permission denied error. However, I was able to rename the directory. All of the commands I've tried on the directory result in permission denied, the same as seen below.

bash-2.04$ ls -al
total 12
drwxrwxrwx 3 handruin handruin 4096 Jun 2 12:56 .
drwxr-xr-x 25 handruin handruin 4096 Jun 2 03:05 ..
drwx------ 2 nobody nobody 4096 Jun 2 12:56 deleteme
bash-2.04$ rm -Rf deleteme
rm: cannot change to directory `deleteme': Permission denied
bash-2.04$
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
Hmm ... yes, sorry Handruin. It occurred to me after posting that this was probably on someone else's box. With the permissions and group set as they are, I can't think of any normal way to get rid of the file.

If I were really desperate, and it were a box I had authority over, I'd check to see if all the latests patches were installed - maybe the previous admin missed a recent local root exploit for example. That probably wouldn't be such a good idea in this case though. :wink:

Other than that, I might try running another script that operates under the same group as before ('nobody' in this case) to remove the directory, instead of creating it.
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
On further thought, a script that just changes the permission of the directory to allow access to anyone would probably be safer than having the script itself delete the directory.
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,637
Location
I am omnipresent
If you have permissions sufficient to change a filename, you can delete that file. The two "classical" solutions to "undeletable files" on Unix systems are to either delete through the use of well-chose wildcards, or to reference the full path to the file starting from the root directory.

Both of those method work for cases where files are undeletable because there are embedded control or escape sequences in filenames, so they should work here, too.
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,637
Location
I am omnipresent
FTP doesn't have a complex enough command interpreter for that. You'll need an actual shell (csh, ksh whatever) to get some real intelligence.
 

Tea

Storage? I am Storage!
Joined
Jan 15, 2002
Messages
3,749
Location
27a No Fixed Address, Oz.
Website
www.redhill.net.au
I used to be able to do that stuff with Telnet, Mercutio. But (a) I've forgotten exactly how, and (b) they have moved my server since then. But my other FTP package (the OS/2 one, at work) has an optional command line. I suspect that that will do it.

On the other hand, the rogue folder - www.redhill.net.au/sr/images/ - is out of the way and causing no trouble.
 
Top