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

  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)

  • 1
    Has appuser read access to /app and /app/services?
    – Hermann
    Commented May 17, 2019 at 20:08
  • /app has 754 and /app/services has 755
    – PDStat
    Commented May 17, 2019 at 21:06
  • Aha ok /app also required 755, thankyou :)
    – PDStat
    Commented May 17, 2019 at 21:14


You must log in to answer this question.

Browse other questions tagged .