I have a script to setup a machine that need to change to another user. Unfortunately, I get a "permission denied" after the su command.
#!/bin/bash
# script executed from /home/foo/
touch hi_foo
cd /home/bar
sudo bar
touch hi_bar <-- permission denied
Any idea of a workaround? My script works well if I copy and paste it in the command line.
I am running Ubuntu 14.04