vagrant-hostmanager
vagrant-hostmanager copied to clipboard
User and SElinux permissons changed for /etc/hosts on host VM
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
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