I have this file:
$ ls -lrta ~/.bash_profile -rwxr-x---. 1 xxx xxx 904 May 23 15:36 /home/xxx/.bash_profile $
I am the owner of the file and I have write permission. When I try to edit (delete the last line for example) the file I got an error,
$ sed -i '$ d' .bash_profile sed: cannot rename ./sedxkZezg: Operation not permitted $
Appending a text using cat can successfully write to file.
$ cat >> .bash_profile writing ^D $
I viewed the appended text like this,
$ cat .bash_profile ... <some text> ... writing $
Error also occurs when I edit the file using a text editor (vi).
Can anyone explain why can't I write the file though I have a write permission?
Here is some information of the system I'm using:
$ uname -svr Linux 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012
Here is what I have tried so far:
$ sed -i '$ d' .bash_profile > file && mv file .bash_profile sed: cannot rename ./sedm89Ym2: Operation not permitted $ lsattr ~/.bash_profile lsattr: Inappropriate ioctl for device While reading flags on /home/xxx/.bash_profile $ getfact ~/.bash_profile getfacl: Removing leading '/' from absolute path names # file: xxx/xxx/.bash_profile # owner: xxx # group: xxx user::rwx group::r-x other::--- $