I am in the process of migrating a machine from RHEL 4 to 5. Rather than actually do an upgrade we have created a new VM (both machines are in a cloud) and I am in the process of copying across data between the two.
I have come across the following file, which I need to remove from the new machine but am unable to, even when running as root:
-rw------- 1 2003 2003 219 jan 11 14:22 .bash_history
This file is inside /home/USER/, where USER is the account of the guy who built the machine. He doesn't have an account on the old machine, so I am trying to remove his home folder so that the new machine tallies with the old one, but I get the following error:
rm: ne peut enlever `.bash_history': Opération non permise
(translated from the French: cannot remove XXX, operation not permitted)
I have tried using the following command but this has made no difference:
chattr -i .bash_history
Is the only choice to create a user with the ID 2003, or is there another way around it?
Edit
I have tried using rm -f
, and I get the same error. I get the same kind of error using chmod 777
first.
I have been able to chown
the folder that contains the file I am trying to delete, so it is:
drwx------ 2 root root 1024 jan 24 15:58 USER
Edit2
Running the lsattr
command as suggested by Angus gave the following output:
-----a------- USER/.bash_history
------------- USER/..
------------- USER/.
The file is flagged as append-only - on changing this flag using chattr -a .bash_history
I was able to delete the file.
/vendor/laracasts/generators/.git/objects/pack/
, when I runchattr -i -a .
, I getchattr: Inappropriate ioctl for device while reading flags on .
, and I can'trm
the pesky.idx
file that Composer left behind (because "Operation not permitted"). – Ryan May 24 '18 at 23:48rm
the files from there. Thencomposer update
was able to complete. – Ryan May 25 '18 at 00:08chattr -i -a
worked. – xji Oct 05 '19 at 00:18