elkarbackup / elkarbackup

Open source backup solution for your network
https://www.elkarbackup.org
Other
397 stars 68 forks source link

Script error - Permission denied sudo: no valid sudoers sources found, quitting #644

Open kekec777 opened 1 year ago

kekec777 commented 1 year ago

Describe the bug

A clear and concise description of what the bug is. Include the following information:

Steps to reproduce the behavior

  1. Create a script and upload it via web gui
  2. Assign to client (either before or after backup)
  3. Run

Expected vs actual behavior

A clear and concise description of what you expected to happen and what actually happened. Expection is : Create backup and run the script

Actually happens: Backup is created succesfully , but when the script is trying to run i get an error (see log)

Logs

Paste log errors. Redact if needed.

ERROR | RunPostClientScriptsCommand |   | Client "1" POST script "Notify via telegram" execution failed. Diagnostic information follows: sudo: unable to open /etc/sudoers: Permission denied sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin -- | -- | -- | --

My script is basic with just some: `#!/bin/bash starttime=$(date +"%m/%d/%Y %T")

echo -e "\n" &>> "/app/backups/PATH TO LOG FILE"; echo "Start date and time" $starttime &>> "/app/backups/PATH TO LOG FILE"; echo "Backup completed" $1 &>> "/app/backups/PATH TO LOG FILE";

endtime=$(date +"%m/%d/%Y %T") echo "End date and time" $endtime &>> "/app/backups/PATH TO LOG FILE"; echo -e "\n" &>> "/app/backups/PATH TO LOG FILE";

send telegram notification

curl "TELEGRAMCONFIGAPI" backup completed "$endtime >/dev/null 2>&1`

So basicly write into a log.txt file and then curl a telegram msg

I have tried to login as root to docker container and execute the .sh without any problem

I have strugled with this for couple hours now , so any advise is fully preciated

thanks in advise

dampflok2000 commented 1 year ago

I have exactly the same problem. Can anyone help? :-(

kekec777 commented 1 year ago

I have exactly the same problem. Can anyone help? :-(

I ended up creating my own image with docker build and now it's working. I can send what I exactly I added to the image latter or tomorrow

dampflok2000 commented 1 year ago

I have exactly the same problem. Can anyone help? :-(

I ended up creating my own image with docker build and now it's working. I can send what I exactly I added to the image latter or tomorrow

Oh that would be mega awesome for me! I look forward to your input! :-)

kekec777 commented 1 year ago

Soo from my own build (im executing from my own web page (user www-data) and im adding www-data to sudo:

FROM elkarbackup/elkarbackup:latest RUN echo 'www-data ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers RUN usermod -a -G sudo www-data && usermod -a -G root www-data RUN chown -R root:www-data /app/uploads/ && chown -R root:www-data /etc/sudoers && chown -R root:www-data /etc/sudoers.d/

but i think this should resolve your problem (run these from container: "docker exec -ti elkarbackup bash") chown -R root:www-data /app/uploads/ and remember to make your .sh executable: chmod +x /app/uploads/000*

You can reply if this is working or not..