From f5cadc93fa3b5a99f69675e89f60cafa832042b8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 19 Nov 2015 18:35:18 -0800 Subject: [PATCH] guests/linux: POSIX sed [GH-6104] --- plugins/guests/linux/cap/remove_public_key.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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