Centos – Cannot delete a dir via SSH: etc/rc.d/init.d/functions’: Operation not permitted

centosmediatemplermssh

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.

Best Answer

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