I have a problem with the following command
sudo -u ${USER} -H sh -c "bash ${START_SCRIPT}"
I can exclude errors with the START_SCRIPT, since
bash ${START_SCRIPT}
works excellent.
I think there must be a problem with the sudo-syntax, but I can't find the answer. Everywhere (e.g. this link, answer by Kimvais or the sudo manpages) suggest the formatation I used above.
USER=some_user
START_SCRIPT=/some/long/path/start.sh
I can only guess that it has to do with the long path or that I miss any arguments for the sudo-command.
In this thread I read:
sudo -H -u otheruser bash -c 'echo "I am $USER, with uid $UID"'
That works perfectly, but neither
sudo -H -u otheruser bash -c '${START_SCRIPT}'
nor
sudo -H -u otheruser -c 'bash "${START_SCRIPT}"'
works.
Can anyone help me please or at least give a hint?