/etc/resolv.conf is open as read-only and cannot edit in Linux

/etc/resolv.conf not able to edit in Linux as the Root user

Error: Try to open the /etc/resolv.conf file from the root user but it’s open as read only file.

Solution:

  1. Check the attribute of /etc/resolv.conf file
[root@rac1 grd]$ lsattr /etc/resolv.conf
----ia------------ /etc/resolv.conf

2. Change or remove this Ia attribute from /etc/resolv.conf

[root@rac1 grd]$ chattr -a /etc/resolv.conf
[root@rac1 grd]$ chattr -i /etc/resolv.conf

3. Check again with /etc/resolv.conf file

[root@rac1 grd]$ lsattr /etc/resolv.conf
------------------ /etc/resolv.conf

4. Now try to open with vi or gedit editor will fix the read-only issue.

[root@rac1 grd]$ vi /etc/resolv.conf

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.