I had to study something with the chef diligently: he can work as a user, but environment variables are not set .
To verify this, run
echo `whoami`
If you need environment variables, just set them (or type a .bash_profile ):
bash "source a file" do user "someUser" cwd "/tmp" environment ({'HOME' => '/home/someUser', 'USER' => 'someUser'}) code <<-EOH source /tmp/test.sh EOH end
As you noticed, have you created a user?
source share