vagrant-hostmanager icon indicating copy to clipboard operation
vagrant-hostmanager copied to clipboard

User and SElinux permissons changed for /etc/hosts on host VM

Open antevens opened this issue 11 years ago • 1 comments
trafficstars

When overwriting /etc/hosts the owner is set to vagrant and the selinux permissions are lost causing various services to fail.

Below is the quick fix workaround:

[vagrant@centos65 var]$ sudo ls -lahZ /etc/hosts -rw-r--r--. vagrant vagrant unconfined_u:object_r:user_tmp_t:s0 /etc/hosts [vagrant@centos65 var]$ sudo restorecon /etc/hosts [vagrant@centos65 var]$ sudo ls -lahZ /etc/hosts -rw-r--r--. vagrant vagrant unconfined_u:object_r:net_conf_t:s0 /etc/hosts [vagrant@centos65 var]$ chown root:root /etc/hosts

antevens avatar Oct 07 '14 15:10 antevens

I am working around this bug with a simple shell provisioner:

  config.vm.provision "fix-hostmanager-bug", type: "shell", run: "always" do |s|
    s.inline = <<-EOT
    sudo restorecon /etc/hosts
    sudo chown root:root /etc/hosts
    EOT
  end

dweingart avatar Jan 08 '15 22:01 dweingart