Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Delete Files With Permission 0000

Posted on 2006-04-13
8
Medium Priority
?
1,778 Views
Last Modified: 2013-12-16
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?

Thanks,

Richard
0
Comment
Question by:rbartz
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 88

Expert Comment

by:rindi
ID: 16461043
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.
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16482722
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.
0
 
LVL 4

Author Comment

by:rbartz
ID: 16496240
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.

Richard
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:m1tk4
ID: 16496295
interesting.

what happens when you run these:

getfacl cgiemail

ls -Z

?

0
 
LVL 22

Accepted Solution

by:
pjedmond earned 500 total points
ID: 16514868
lsattr

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

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

chattr -i

to remove

http://www.securityfocus.com/infocus/1407

for more info.

HTH:)
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 16514871
...obviously once you've got rid of the immutable flag, then you can delete it:)
0
 
LVL 4

Author Comment

by:rbartz
ID: 16515008
Sorry m1tk4...

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

pjredmond...

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!

Thanks!

Richard
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 16516198
A pleasure:)
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question