0

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

2 Answers 2

1

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/ 
2
0

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.

2
  • 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, 2011 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, 2011 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .