diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index 80abb4a4a..acc4417c1 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -42,7 +42,7 @@ module VagrantPlugins def chown_provisioning_folder @machine.communicate.tap do |comm| comm.sudo("mkdir -p #{@config.provisioning_path}") - comm.sudo("chown #{@machine.config.ssh.username} #{@config.provisioning_path}") + comm.sudo("chown -R #{@machine.ssh_info[:username]} #{@config.provisioning_path}") end end diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index dfc1567a3..af4980830 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -12,6 +12,11 @@ module VagrantPlugins with_script_file do |path| # Upload the script to the machine @machine.communicate.tap do |comm| + # Reset upload path permissions for the current ssh user + user = @machine.ssh_info[:username] + comm.sudo("chown -R #{user} #{config.upload_path}", + :error_check => false) + comm.upload(path.to_s, config.upload_path) if config.path