Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.