I have a user with sudo access, I am moving a jar file into another directory and then making sure the directory and its contents belong to that user before trying to run the jar as that user, for example
#!/bin/bash
WORKDIR=/app/services/myapp
sudo mv myjar.jar $WORKDIR
sudo chmod -R 755 $WORKDIR
sudo chown -R appuser:appuser $WORKDIR
sudo -S su - appuser -c "java -jar $WORKDIR/myjar.jar"
However I get the following
Error: Unable to access jarfile /app/services/myapp/myjar.jar
What could be the issue? I notice I can ls the $WORKDIR (with sudo) but I can't cd into it (even with sudo)
appuser
read access to/app
and/app/services
?/app
has 754 and/app/services
has 755/app
also required 755, thankyou :)