Unable to edit /etc/hosts with permission denied error

[15:45:02][rabbie@sandnigga:~]# sudo cat /etc/hosts

Password:

cat: /etc/hosts: Permission denied

[15:45:09][rabbie@sandnigga:~]#


Basically that's my problem right there. I cant edit / view / change the hosts file on my macbook pro but I can delete it and create a new one. If I do delete it and create a new one, that new file then has the same problem only a few minutes later.


Does anyone have any ideas ?


I have also tried to change the ownership and permissions of the file:


[15:45:09][rabbie@sandnigga:~]# ls -la /etc/hosts

-rwxrwxrwx 1 root wheel 290 18 Sep 20:38 /etc/hosts


No luck.


Thanks in advance for any help.

MacBook Pro (Retina, Mid 2012), OS X Mountain Lion (10.8.1)

Posted on Sep 18, 2012 10:47 PM

Reply
3 replies

Sep 20, 2012 8:07 PM in response to BobHarris

Hey Bob,


The hosts file is often edited and added to by network administrators as well as web developers to force your local computer to resolve DNS for sites whos DNS is not yet publicly available.


I actually found the problem and root cause behind this. I installed BitDefender Antivirus on my MacBook Pro and the uninstall script did not successfully remove all settings / files. There were still some BitDefender files locking processes and files on my Mac and so I just ended up Wiping my drive and re-installing Mountain Lion.


Thanks for your attempt to help anyway.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Unable to edit /etc/hosts with permission denied error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.