I am using a command to start a screen session and run a bash script for a user.
/bin/su username -c "/usr/bin/screen -dmS test bash -c '/home/username/test.sh; exec bash'"
When I boot, I am seeing the screen session appear for that user, but when I open it, I see a permission denied error.
I checked permissions on the file and it is:
-rw-rw-r-- 1 username www-data 816 Feb 18 00:59 test.sh
Anyone have a theory why I am seeing this error? I can run the script no problem when I am logged in as username.