Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to delete a backup directory on MediaTemple's (dv) via SSH. The directory is "old" and contains the entire server contents from OS level that (mt) backed up there after my server was hacked. I want to remove it in case there's any malware etc there that could compromise the server again. It is not permitting me though:

cannot remove `old/etc/rc.d/init.d/functions': Operation not permitted

I tried rebooting the server and retrying the delete but still same.

share|improve this question
Are you the root user? – atx Mar 1 '11 at 19:28
What does ls -lZ old/etc/rc.d/init.d/functions say? lsattr old/etc/rc.d/init.d/functions? – DerfK Mar 1 '11 at 19:45
ls -lZ old/etc/rc.d/init.d/functions -rwxr-xr-x root root old/etc/rc.d/init.d/functions – Jay Mar 2 '11 at 18:23
up vote 2 down vote accepted

If you are working as root and this happens then there may be extended attributes set on the file. Have a look at the output of

lsattr /old/rc.d/init.d/functions

if you get an output containing an i

----i-------- /old/rc.d/init.d/functions

then the file is imutable and cannot be deleted. To remove the i

chattr -i /old/rc.d/init.d/functions
share|improve this answer
Hey Iain, it did have an 'i' in the attributes, so I removed as you described but still would not permit deletion: sattr old/etc/rc.d/init.d/functions -----a------- old/etc/rc.d/init.d/functions rm -rf old rm: cannot remove old/etc/rc.d/init.d/functions': Operation not permitted ` – Jay Mar 2 '11 at 18:33
@Jay: check the /old/rc.d/init.d for the i flag and remove it if it's there. It may be an idea to run chattr -R -i /old – Iain Mar 2 '11 at 18:43
Thanks Iain - I just removed the ----a------ also which was causing the file to be un-deletable! – Jay Mar 3 '11 at 6:28

I am assuming you are working as root? If so, try to explicitely set ownership and permissions for the whole tree and then try the delete again:

  chown -R root old
  chmod -R u+rwx old 
  rm -rf old 
share|improve this answer
What should I set the permissions to? – Jay Mar 1 '11 at 19:34
See my edit, this is a real broad sweep, but should help. Be real careful though that you only affect the old directory. – Sven Mar 1 '11 at 19:38

Your Answer


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.