When I execute shell, but it is carried out by cron "sudo: sorry, you must have a tty to run sudo" appears. but how should this have dealt?
|
feedback
|
|
You don't need sudo to run programs as other users in cron (at least with the system crontab). Just change the user field from root to the target user. If you really want su does work in cron. | |||||||
feedback
|
|
You can also simply reconfigure sudo to not require a tty by: Editing (as root) the file
And commenting out the line that says:
| |||
|
feedback
|
|
You can add You're better off running it from the crontab of the desired user in the first place, and avoiding the need for sudo. To edit fred's crontab:
| ||||
|
feedback
|