sudo with -u via ssh -t in a crontab
- by DJK_devel
I'm trying to create a cron job that uses ssh to login to a remote server and run a script as a different user. I try:
* * * * * source $HOME/.keychain/$HOST-sh && sudo -u $USER $PATH/$SCRIPT
but this doesn't work because there is no -t option specified for ssh. The cron job needs to source the keychain file in order to work without a password, but I'm not sure where to include the -t option for ssh in this instance.