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.
Asked
Active
Viewed 7,489 times
8
Ben
- 1,016
- 2
- 12
- 14
1 Answers
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.
-
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](https://github.com/holman/dotfiles). 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