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
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

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
| improve this question | | | | |
  • 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: stackoverflow.com/questions/36944634/… – gaoithe Jan 26 '17 at 11:21

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

Defaults    requiretty
| improve this answer | | | | |
  • That's what I read other places, and the problem is that there is no such line to comment out. – Svish Oct 8 '13 at 8:37
  • then just try adding Defaults !requiretty – Doug Oct 8 '13 at 17:19

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