Delete Files With Permission 0000

This is probably an easy question with an obvious answer, but it escapes me...

Our dedicated server provider used CHMOD 0000 to stop the use and abuse of cgiemail - a good idea.  However, they did it server wide so all the sites cgiemail scripts were zeroed.

They left the zeroed cgiemail in the "site skeleton setup" as well, so every site gets a zeroed copy of cgiemail.  That causes some confusion and so on, so I want to remove the cgiemail from our sites and from the skeleton dirs...

The directory looks like this:
----------    1 root     root        33869 Jan 15  2004 cgiemail
----------    1 root     root        33620 Jan 15  2004 cgiemail.ORIG
----------    1 root     root        33869 Apr 13 20:27 cgiemail.PATCHED-OK

When I try, as root, to delete it, I get:

[root@XXXX cgi-bin]# rm cgiemail
rm: cannot unlink `cgiemail': Operation not permitted

When I try CHMOD 600 cgiemail I get:

[root@XXXX cgi-bin]# chmod 600 cgiemail
chmod: changing permissions of `cgiemail': Operation not permitted

When I try rm -rf I get

[root@XXXX cgi-bin]# rm -rf cgiemail
rm: cannot unlink `cgiemail': Operation not permitted

mv makes a copy, doesn't delete, so I can't even hide it...

So, HOW do I get rid of it or change the file name?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can't, as you are only root inside your environment and not serverwide. You'd have to ask your provider to do that for you.
you first need to chmod the directory that contains these files to 0600, chances are its 0000 as well and that's why it doesn't let you modify the file modes.
rbartzAuthor Commented:
Thanks for your suggestions, this is hard for me to understand!  However, we are not there yet...

rindi...  this is on a true (not virtual) dedicated server, and we have full root access.  We are able to do anything (or at least I thought so!)  The directory and files are owned by root in this case.  I don't know what  you mean "root inside your environment" rather than serverwide.  I am not aware of any permissions higher than root!  That is what puzzled me.

m1tk4...  The directory is owned by root and permissions are 0755:

drwxr-xr-x    2 root     root         4096 Apr 13 20:21 cgi-bin

This directory is the cgi-bin directory "skeleton" our server administrative scripts copy into any new sites we host as standard cgi scripts. There are other files there we can change with no problem, only those which have been chmod'd 0000 that cannot be deleted, moved, or changed.  When it copies the files in this directory to a new site directory structure, it copies the files ( -a ) with permissions and then chowns them to the site owners user and group.  So we end up with copies on every site that cannot be deleted.

Thanks again for your help.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.


what happens when you run these:

getfacl cgiemail

ls -Z



should give you a list of the *extended* attributes.

My guess is that the +i (immutable) flag has been set?

chattr -i

to remove

for more info.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
...obviously once you've got rid of the immutable flag, then you can delete it:)
rbartzAuthor Commented:
Sorry m1tk4...

getfacl is not installed on this machine, and -Z isn't an valid option for ls. (RedHat 7.3)


Yes...  # lsattr cgiemail
---i---------- cgiemail

right on... chattr -i cgiemail removed the immutable flag and it deletes just fine

I learned something today, and you get the points!


A pleasure:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.