Ubuntu – Is it possible for /etc/hosts to include a file from the home directory

configurationhosts

I would like to setup Ubuntu One to sync a hosts file in my home directory between my machines. Ideally I would setup all my local web development URLs there and it would just sync between devices. But I'm wondering if it's possible for me to setup /etc/hosts so that it includes a file from my user's home directory.

Best Answer

But I'm wondering if it's possible for me to setup /etc/hosts so that it includes a file from my user's home directory.

The /etc/hosts file is for mapping hostnames to IP addresses before DNS can be referenced. So the answer is no.

I would like to setup Ubuntu One to sync a hosts file in my home directory between my machines.

Would a hard link in your directory to /etc/hosts not accomplish that? Something like this (where shared-directory will be your synch folder):

cd ~/shared-directory/
ln -i /etc/hosts hosts

The only difference in approach is that you then share 1 of your actual host files with all the other systems. And not a copy in your home directory.