Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Someone did something like chmod 444 *, now there're some dirs I cannot remove...

ls -al shows:

4.0K drwxrwxrwx 6 root root 4.0K Apr  7 10:06 .
4.0K drwxr-xr-x 4 root root 4.0K Apr 14 19:51 ..
4.0K dr--r--r-- 4 root root 4.0K Feb 11 08:42 beta
4.0K dr--r--r-- 2 root root 4.0K Apr  2 23:39 download

# rm beta/ -rf
rm: cannot remove directory `beta//xxx': Permission denied
rm: cannot remove `beta//yyy.xml': Permission denied

I did everything I know like chmod +x or cd into the dir to remove the files but failed.

Edit: I logged in as root. I tried chmod +x beta.

# ls -al
total 24
drwxrwxrwx 6 root root 4096 Apr 14 22:20 .
drwxr-xr-x 4 root root 4096 Apr 14 19:51 ..
dr--r--r-- 4 root root 4096 Feb 11 08:42 beta
dr--r--r-- 2 root root 4096 Apr  2 23:39 download
# chmod +x beta
chmod: changing permissions of `beta': Operation not permitted
share|improve this question

2 Answers 2

As your prompt is # I am assuming you are logged in as root.

The problem is your command line. From the rm man page the syntax is

rm [OPTION]... FILE...

so try

rm -rf beta/ 
share|improve this answer
    
No it's not. GNU coreutils accept format like rm beta/ -rf, BSD does not. –  yaroot Apr 14 '11 at 14:39
    
Odd I looked at gnu.org/software/coreutils/manual/html_node/… for that information and it says rm [option]... [file]... –  Mark Apr 14 '11 at 17:03

You're going to have to change the mode of the directories back to 755 or whatever so that they are executable. The execution bit is what allows the directories to act like directories and let you go into them. When you run rm -fr beta, the first thing that it does is descend into the beta directory, if it can't go into that directory, it will fail right off the bat. This shouldn't fail if you are the root user though. The # in your prompt implies that you are the root user though so it might be something else.

share|improve this answer
    
Yes I logged in as root. I can't chroot or mv beta xxx.. I'm confused.. SELinux is disabled.. I did everything I know.. –  yaroot Apr 14 '11 at 14:52
    
Oh right, your username told me that. ;-) What type of filesystem is this and how is it mounted? I would run fsck to make sure you don't have something else going on. I don't see how someone just running chmod 444 * would be irreversible. –  deltaray Apr 15 '11 at 14:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.