Switching to superuser while shell script is running
I need to switch users in a script and keep executing commands. I thought
-c would help but i don't know how to use it properly nor any idea how to do this. I wrote
bash -c "su user && command arg1 arg2"
It tried to execute the command after i typed in exit. I tried setting UID and executing it but the app seems to know what user i am (root) and does things which i can not access as the user i am targeting so it looks like i really do need to figure out how to switch users and continue to execute bash code.