1

I'm trying to run a script as another user that starts a piece of software (Etherpad), which is run like so (from root): su -c "/var/www/etherpad-lite/bin/run.sh" -s /bin/bash etherpad but I'm getting the following error: bash: /var/www/etherpad-lite/bin/run.sh: Permission denied

This had previously worked perfectly, and only stopped working after I installed a bunch of things for another project I'm working on, none of which should have affected etherpad.

/var/log/auth.log shows this:

Aug 12 19:59:21 bhs1 su[7289]: Successful su for etherpad by root
Aug 12 19:59:21 bhs1 su[7289]: + /dev/pts/1 root:etherpad
Aug 12 19:59:21 bhs1 su[7289]: pam_unix(su:session): session opened for user etherpad by root(uid=0)
Aug 12 19:59:21 bhs1 su[7289]: pam_unix(su:session): session closed for user etherpad

I've done some searching and I found a couple of things that could cause this, but none are relevant to my problem:

  • The file is chmodded to 777 (-rwxrwxrwx) and it's owned by the etherpad user. I only changed it to 777 to make sure it wasn't a permissions issue, it was something like 700 before.
  • The file system doesn't have noexec enabled

I'm running Debian 7.6 on a dedicated server.

  • Do you have SELinux enabled? It might as well be a problem. – Ramesh Aug 13 '14 at 0:07
  • @Ramesh I found some SELinux related files on the server (/selinux and /etc/selinux exist) but, following a guide to disable it (thegeekstuff.com/2009/06/…), none of the specified config files exist on my server – ev0lution Aug 13 '14 at 0:24
  • I'm not saying that it is wrong, and I don't have a Linux server to test this on right now, but I've never seen the user specified at the end of an su command. Does anything change if the command becomes su etherpad -c "/var/www/etherpad-lite/bin/run.sh" -s /bin/bash? (It may be perfectly acceptable to have it at the end, but a quick internet search did not show any examples of that). – Warwick Aug 13 '14 at 0:58
  • What happens if you su etherpad and do an ls /var/www/etherpad-lite/bin/run.sh? Or ls the individual components? Rule out an actual permissions problem first and that may help you. – eewanco Aug 13 '14 at 14:43
2

You can have run.sh with "read by all" privilegs, but if e.g. /var/www/ is with privilegs "read only by root" you will get "permission denied" error message.

check permissions of all directories in the path

/var/
/var/www/
/var/www/etherpad-lite/
/var/www/etherpad-lite/bin/
  • Wow, that's embarrassing. Something had indeed changed /var/www so that it was no longer executable. Thank you very much :) – ev0lution Aug 14 '14 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.