I am logged in as root and want to execute a Bash script with sudo permissions as another user.
This is the test Bash script in
mkdir -p /etc/test # Creating an /etc directory to test permissions echo "test $(whoami) $USER $HOME" > /etc/test/a.txt
The command I currently have (run from root, run for me):
sudo --non-interactive --login --set-home --user=me \ sudo --non-interactive bash /home/me/sudo.bash
test root root /home/me
What I expected:
test me me /home/me
What am I doing wrong here?