6

I have tried to set up a scheduled backup of my Minecraft server. I used a script I found on GitHub at frdmn/minebackup.sh and it seems to work great when I run it from the terminal directly.

The cronjobs I have set up however doesn't work for some reason. In mails I get these error messages:

Hexxit Server is running, suspending saves... su: must be run from a terminal
su: must be run from a terminal
su: must be run from a terminal
done
Backing up hexxit-01... done
Total backup size (175 MiB) <= (5000 MiB)... done
Hexxit Server is running, re-enabling saves... su: must be run from a terminal
su: must be run from a terminal
done

The main problem seems to be su: must be run from a terminal and I assume this has to do with security issues on the server and not the script, so that's why I'm asking here.

It's more or less a freshly installed instance of Debian 7.1.0 x64 with one user on it, mc. How do I fix it so that this script runs successfully?

The cronjobs look like this and have been added using crontab -e

*/15 * * * * /usr/bin/minebackup backup
0 0 * * * /usr/bin/minebackup backup full

I've been searching around for a bit and I have a feeling I need to edit /etc/sudoers, but the line which I was supposed to comment away isn't even in the file, so I don't know if Debian has changed its defaults or... eh?

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

root    ALL=(ALL:ALL) ALL

%sudo   ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d
Svish
  • 6,977
  • 15
  • 38
  • 45
  • the duplicate question/answer I'm afraid also does not have any good answer. The problem is nothing to do with sudo. It is to do with pty allocation. IF user is going in using ssh then solution is to force pty allocation using 'ssh -t' or 'ssh -tt' other options I have tried to answer better here: http://stackoverflow.com/questions/36944634/su-command-in-docker-returns-must-be-run-from-terminal/41872292#41872292 – gaoithe Jan 26 '17 at 11:21

1 Answers1

0

try editing /etc/sudoers using visudo and comment out:

Defaults    requiretty
Doug
  • 371
  • 2
  • 6
  • 15