8

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.

Ben
  • 1,016

1 Answers1

5

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.

Rinzwind
  • 299,756
  • Along the same line of thinking with this, it might be worth checking out how some developers handle their "dotfiles" (my personal favorite is Holman's from GitHub. They generally keep a repository/shared folder somewhere with the files, then symlink them into their home in the filesystem (so reverse Rinzwind's symlink code to be ln -i hosts /etc/hosts). – Shauna Mar 20 '13 at 13:04