When running script in crontab I get an error
sudo: sorry, you must have a tty to run sudo
How to fix this problem?
- In /etc/sudoesr update
Defaults requiretty to Default !requiretty
- Disable per user
Defaults:myuser !requiretty
- Disable per command
Defaults!/path/to/my/bin !requiretty
If you executing command throw ssh connect using -t option
From ssh manual:
-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.