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/
This commit is contained in:
Alan Shields 2011-05-17 15:23:54 -07:00 committed by Mitchell Hashimoto
parent 2d9d16d6e1
commit 33538d2900
1 changed files with 1 additions and 1 deletions

View File

@ -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"