Cannot edit hosts file. Please help

Discussion in 'Mac OS X Lion (10.7)' started by Silas1066, Aug 25, 2011.

  1. Silas1066 macrumors regular

    Nov 1, 2009
    I need to use a hosts file because the Cisco AnyConnect VPN client won't allow me to resolve internal DNS names.

    When I do a

    sudo vi /private/etc/hosts

    I get an "empty" hosts file. I try to edit anyway, but when I try to save I get

    E166: Can't Open Linked File For Editing

    wtf? Linked where?

    any advice would be welcome.
  2. nebo1ss macrumors 68030

    Jun 2, 2010
    If google "editing host file on a mac" you will find your answer.
  3. Silas1066 thread starter macrumors regular

    Nov 1, 2009
    I have already gone through dozens of pages of documentation -nothing has worked

    If I do a ls -la in the /etc/ directory, I see

    lrwxr-xr-x 1 root wheel 18 Jan 13 2010 hosts -> /etc/gasmask/hosts

    there is some kind of link

    but /etc/gasmask doesn't exist or cannot be accessed
  4. tygrubb macrumors regular

    Jun 23, 2010
    In case things changed with Lion, I tried the usual way of editing the hosts file.

    sudo nano /etc/hosts
    and it worked as usual. Maybe something got borked on your particular install? Good luck tracking it down. "/etc/hosts" is supposed to be symlinked to "/private/etc/hosts"; if the latter for you is symlinked to something else, me wonders if there possibly be some malware afoot.
  5. sidewinder macrumors 68020


    Dec 10, 2008
    Northern California
    You obviously had installed "Gas Mask" at some point. Who know how you fix what that software did. Try contacting them:


Share This Page