/etc/hosts being overwritten

Discussion in 'Networking' started by bernies, Mar 23, 2009.

  1. bernies

    bernies

    Joined:
    Dec 8, 2008
    Messages:
    5
    Likes Received:
    0
    Ok, so I'm setting up my aspire one to do some development work while on the road. I have Apache installed, and want to add an alias for 127.0.0.1, however something overwrites /etc/hosts when I boot.
    I've seen lots of others with a similar problem on Ubuntu, but haven't come across anyone who's published a solution yet. Does anyone know what's going on? And how do I set an alias for localhost?
    Thanks,
    Bernie
     
    bernies, Mar 23, 2009
    #1
  2. bernies

    dattaway

    Joined:
    Sep 2, 2008
    Messages:
    198
    Likes Received:
    0
    Location:
    Kansas Citeeeeeeeeee, MO
    Sounds like a rogue startup script finds it necessary to change it. You can stop that with the "chattr +i /etc/hosts" command. That will make the file "immutable." Nothing, not even root, will be able to write or append to this file without that bit cleared "-i". You can also list these special permissions with the "lsattr" command just like the "ls" command.

    To set an alias for localhost, just put "localhost" in the same line after the IP number you want it set. You can have multiple names or aliases after a given IP number.
     
    dattaway, Mar 23, 2009
    #2
  3. bernies

    bernies

    Joined:
    Dec 8, 2008
    Messages:
    5
    Likes Received:
    0
    Ok, I'll go with the chattr solution. I had read that somewhere else, but it seemed like a bit of a kludgy way to fix it. I was hoping to find the service responsible and either stop it doing it, or edit the source files or configuration files it uses.

    Thanks anyway,
    Bernie
     
    bernies, Mar 23, 2009
    #3
  4. bernies

    ktheintz

    Joined:
    Sep 5, 2008
    Messages:
    3
    Likes Received:
    0
    ktheintz, Jun 8, 2009
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.