Ошибки вида "sudo: no tty present and no askpass program specified" в CRON
В кроне стоит такая команда (автоочистка кэша):
sudo find /tmp/ -name "magick-*" -type f -delete
(выполняется ежесуточно)
В итоге мне каждые сутки на почту приходит это:
sudo: no tty present and no askpass program specified
Сама команда, разумеется не выполняется
Нашел примерное решение (отсюда):
Granting the user to use that command without prompting for password should resolve the problem.
First open a shell console and type:
sudo visudoThen edit that file to add to the very end:
username ALL = NOPASSWD: /fullpath/to/command, /fullpath/to/othercommandeg
john ALL = NOPASSWD: /sbin/poweroff, /sbin/start, /sbin/stopwill allow user john to sudo poweroff, start and stop without being prompted for password.
Не понятны только 2 вещи: во-первых, какой полный путь к команде "find", во-вторых, как узнать от какого юзера выполняется крон.
Ну и другие варианты решения проблемы приветствуются