From 33538d290059f1225c2fad32d08a01dc3e2bf1e8 Mon Sep 17 00:00:00 2001 From: Alan Shields Date: Tue, 17 May 2011 15:23:54 -0700 Subject: [PATCH] Set the home directory to /root when using sudo Encountered this issue while using puppet. Created configuration file /root/.my.cnf but mysql was looking for /home/vagrant/.my.cnf Passing -H to sudo causes sudo to set env HOME=/root/ --- lib/vagrant/ssh/session.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant/ssh/session.rb b/lib/vagrant/ssh/session.rb index a82bc658b..7c0874d8b 100644 --- a/lib/vagrant/ssh/session.rb +++ b/lib/vagrant/ssh/session.rb @@ -34,7 +34,7 @@ module Vagrant # of `sudo`. def sudo!(commands, options=nil, &block) channel = session.open_channel do |ch| - ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success| + ch.exec("sudo -H #{env.config.ssh.sudo_shell} -l") do |ch2, success| # Set the terminal ch2.send_data "export TERM=vt100\n"