oscar-stack / vagrant-hosts

Manage static DNS on vagrant guests
Other
317 stars 26 forks source link

vagrant-hosts changes file mode of /etc/hosts to 0600 #42

Closed antaflos closed 9 years ago

antaflos commented 9 years ago

It seems running the hosts provisioner sets the file mode of /etc/hosts on the provisioned system to 0600, preventing other users on the system from reading the file.

I tested this using the following lines in the Vagrantfile:

  config.vm.provision :hosts do |provisioner|
    # Add a single hostname
    provisioner.add_host '10.17.42.100', ['foo.example.vm']
  end

Using vagrant-hosts 2.2.3 and vagrant 1.6.3 on Ubuntu 14.04, provisioning Ubuntu 12.04 VMs.

adrienthebo commented 9 years ago

What is the umask of the root user on the guest system?

Sharpie commented 9 years ago

Vagrant Hosts updates /etc/hosts in the following manner:

install -m 644 /tmp/hosts /etc/hosts

If the mode is coming out as 0600, check your root umask, as @adrienthebo suggested.