Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have changed my host file to allow me access via RDC to computers over VPN network. I change the ip's and it works fine. My problem is that every time I log back onto my computer they have reverted/deleted. Im using a mac. I am the administrator as well.

im using

 sudo nano /private/etc/hosts

To edit my host file.

Does anyone have any idea why this is happening?

share|improve this question
    
Have you tried to change /etc/hosts instead? –  wollud1969 Sep 6 '12 at 9:34
    
Im not too sure what yo mean? –  Will Sep 6 '12 at 9:41
    
On Mac OS X both files are the same file (hard link). /etc/hosts and /private/etc/hosts have the same inode number (check with ls -i /private/etc/hosts /etc/hosts) –  Matteo Sep 6 '12 at 9:53
    
@Matteo 'Will$ ls -i /private/etc/hosts /etc/hosts ,6082256 /etc/hosts ,6082256 /private/etc/hosts' –  Will Sep 6 '12 at 11:11
add comment

1 Answer

If you are using Cisco's AnyConnect it rewrites the hosts file.

Check if you have a /etc/hosts.ac file: AnyConnect uses it to recreate /etc/hosts.

In any case you can define aliases with dscl (from http://hints.macworld.com/article.php?story=20111011050950471):

Instead of modifying the hosts file, it's much more reliable to use the dscl command, which has been available since Leopard. Check out http://jonathan.tron.name/2008/01/05/hosts-aliases-in-leopard

share|improve this answer
    
I checked the '/etc/hosts.ac' There was no content. I put my IP's in there but it still changed back when I rebooted –  Will Sep 6 '12 at 11:09
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.