I'm running a bash script from a root perspective which then starts a program in the script
su -c "sh /home/user2/script.sh" -m user2
The problem is that the program started by this script, while executed as user2, is still trying to create files in /root/.config/, which of course fails as it's not permitted by user2.
Am I doing anything wrong? Is is there another better way to actually change user in the script, enter the user's password then start the program?