Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I added some lines to my /etc/hosts file to resolve a private hostname, but every time after rebooting, the lines I added get lost. Should there be any setting options to make these changes take effect?

share|improve this question
    
Do you edit it from root? –  Daniil Aug 31 '12 at 2:54
    
@Daniil yes, of course –  qiuxiafei Aug 31 '12 at 6:51
    
Are you using some third-party VPN client. Some "disfunctional" clients modify the /etc/hosts files themselves. –  Gerry Aug 31 '12 at 8:09
add comment

4 Answers

up vote 4 down vote accepted

The Cisco AnyConnect VPN Client is known to show this behavior. It will reset your /etc/hosts file on reboot to the contents of /etc/hosts.ac.

If you use this VPN client, you should make your modifications to both files.

See this hint for more info.

http://hints.macworld.com/article.php?story=20111011050950471

share|improve this answer
    
god, i really use Cisco AnyConnect VPN... –  qiuxiafei Sep 5 '12 at 1:49
add comment

Looks like some app deletes this lines from /etc/hosts on system startup. OS X itself doesn't delete any lines on startup nor reboot.

share|improve this answer
    
And my estimated guess would be a third party VPN client. –  Gerry Aug 31 '12 at 8:04
add comment

After changing the hosts file, change the permissions on it to stop the file being modified. You may have to play a bit to see what works.

share|improve this answer
add comment

Try sudo nano /private/etc/hosts in Terminal.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.