diff --git a/plugins/guests/linux/cap/remove_public_key.rb b/plugins/guests/linux/cap/remove_public_key.rb index a8d773a40..de696fa69 100644 --- a/plugins/guests/linux/cap/remove_public_key.rb +++ b/plugins/guests/linux/cap/remove_public_key.rb @@ -10,8 +10,10 @@ module VagrantPlugins machine.communicate.tap do |comm| if comm.test("test -f ~/.ssh/authorized_keys") - comm.execute( - "sed -i '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys") + comm.execute(< ~/.ssh/authorized_keys.new +mv ~/.ssh/authorized_keys.new ~/.ssh/authorized_keys +SCRIPT end end end