{"action":"closed","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/3293","repository_url":"https://api.github.com/repos/mitchellh/packer","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/3293/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/3293/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/3293/events","html_url":"https://github.com/mitchellh/packer/issues/3293","id":137721474,"number":3293,"title":"Avoiding \"Vagrant insecure key detected. Vagrant will automatically replace...\" in boxes created with Packer","user":{"login":"jerzygangi","id":1406581,"avatar_url":"https://avatars.githubusercontent.com/u/1406581?v=3","gravatar_id":"","url":"https://api.github.com/users/jerzygangi","html_url":"https://github.com/jerzygangi","followers_url":"https://api.github.com/users/jerzygangi/followers","following_url":"https://api.github.com/users/jerzygangi/following{/other_user}","gists_url":"https://api.github.com/users/jerzygangi/gists{/gist_id}","starred_url":"https://api.github.com/users/jerzygangi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerzygangi/subscriptions","organizations_url":"https://api.github.com/users/jerzygangi/orgs","repos_url":"https://api.github.com/users/jerzygangi/repos","events_url":"https://api.github.com/users/jerzygangi/events{/privacy}","received_events_url":"https://api.github.com/users/jerzygangi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/packer/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-01T23:32:43Z","updated_at":"2016-03-01T23:45:07Z","closed_at":"2016-03-01T23:45:07Z","body":"I'm building a CentOS Packer box for Vagrant and VirtualBox.\r\n\r\nIn my Packer template, I run a bash script to configure the box for Vagrant:\r\n\r\n```\r\nmkdir -pm 700 /home/vagrant/.ssh\r\ncurl -L https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o /home/vagrant/.ssh/authorized_keys\r\nchmod 0600 /home/vagrant/.ssh/authorized_keys\r\nchown -R vagrant:vagrant /home/vagrant/.ssh\r\n```\r\n\r\nAfter the box is built, I `vagrant up` with it. This warning comes up:\r\n\r\n```\r\ndefault: Vagrant insecure key detected. Vagrant will automatically replace\r\ndefault: this with a newly generated keypair for better security.\r\ndefault:\r\ndefault: Inserting generated public key within guest...\r\ndefault: Removing insecure key from the guest if it's present...\r\ndefault: Key inserted! Disconnecting and reconnecting using new SSH key...\r\n```\r\n\r\nWhat do I need to do in my Packer to avoid this warning?"}}