I just faced a really strange situation.
I was trying to edit file
/usr/lib/thunderbird/thunderbird.sh, which has the following permissions:
$ ll /usr/lib/thunderbird/thunderbird.sh -rwxr-xr-x 1 root root 2730 Aug 20 12:55 /usr/lib/thunderbird/thunderbird.sh*
and I found that if I issue
sudo vim /usr/lib/thunderbird/thunderbird.sh
When I switch to insert mode I get a warning message:
/usr/lib/thunderbird/thunderbird.sh [RO] W10: Warning: Changing a readonly file -- INSERT --
And I actually cannot write any changes.
However, if I issue:
user@hostname:~$ sudo su - root@hostname:~# vim /usr/lib/thunderbird/thunderbird.sh
I can edit the file without problems.
The strange thing is that I have edited lots of files with similar permissions, such as the configuration files in
/etc/, without issues, and that If I create a file inside the same directory I have no problems editing it:
user@hostname:~$ sudo touch /usr/lib/thunderbird/test.sh user@hostname:~$ sudo chmod 755 /usr/lib/thunderbird/test.sh user@hostname:~$ ll /usr/lib/thunderbird/test.sh /usr/lib/thunderbird/thunderbird.sh -rwxr-xr-x 1 root root 0 Aug 20 13:03 /usr/lib/thunderbird/test.sh* -rwxr-xr-x 1 root root 2730 Aug 20 12:55 /usr/lib/thunderbird/thunderbird.sh* user@hostname:~$ sudo vim /usr/lib/thunderbird/test.sh
This is my sudoers file:
# Cmnd alias specification Cmnd_Alias APT = /usr/bin/apt-get update, /usr/bin/apt-get upgrade # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL %sudo ALL=(ALL:ALL) NOPASSWD: APT
And my user is inside sudo group.
Any idea about why this happens?