I have the following statement in bacula:

RunBeforeJob = "sudo /bin/mountpoint /backup/external || sudo /bin/mount /dev/mapper/bacula"

But it fails:

sudo: pam_unix(sudo:auth): conversation failed
sudo: pam_unix(sudo:auth): auth could not identify password for [bacula]
sudo: pam_succeed_if(sudo:auth): requirement "uid >= 1000" not met by user "bacula"
sudo:  bacula : command not allowed ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/mountpoint /backup/external || sudo /bin/mount /dev/mapper/bacula

I've found that bacula user can run one command in "RunBeforeJob" but cannot two commands. I don't understand why and how to fix it. I wonder that if I remove the pam restriction of "uid >=1000" it would work, but I'd like to find a better solution.

Note: I've disable requiretty in sudoers.

  • 4
    The problem is that sudo is trying to run /bin/mountpoint /backup/external || sudo /bin/mount /dev/mapper/bacula as a single command, where presumably it is allowed to run sudo /bin/mountpoint /backup/external or sudo /bin/mount /dev/mapper/bacula. Maybe bacula doesn't support shell syntax in RunBeforeJob. Putting your commands in a script and use that as RunBeforeJob may work. – muru Dec 27 '16 at 12:23
  • @muru Your solution worked. You may want to post it as an answer :) – sebelk Dec 27 '16 at 19:57

Your Answer

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

Browse other questions tagged or ask your own question.