Can’t edit /etc/resolv.conf with root account problem.

  • A file is set with ‘i‘ attribute, cannot be modified (immutable). Means no renaming, no symbolic link creation, no execution, no writable, only superuser can unset the attribute.
  •  we use the + sign and to unset use the – sign with the chattr command.
    + : Adds the attribute to the existing attribute of the files.
    – : Removes the attribute to the existing attribute of the files.
    = : Keep the existing attributes that the files have.
vi /etc/resolv.conf 
/etc/resolv.conf" [readonly] 12L, 301C 
[root@rhel6 ~]# lsattr /etc/resolv.conf
----i--------e- /etc/resolv.conf
[root@rhel6 ~]# chattr -i /etc/resolv.conf
[root@rhel6 ~]# lsattr /etc/resolv.conf
-------------e- /etc/resolv.conf
[root@rhel6 ~]# vi /etc/resolv.conf
Advertisements