Password-less unattended CVS+SSH sessions

You may have the need some day to issue CVS commands (same stands for SVN I think) using the SSH connection (such as CVS_RSH=ssh and so on) in a crontab. The problem may be that you need to type a password to get granted the SSH connection. With SSH public keys and ssh-agent it’s easy, but in a crontab, that will no longer work 🙁

It’s pretty easy… well… doable at least 😉

The trick is to launch the CVS commands with a “ssh” script in the PATH, which will be something like this :

#! /bin/sh

export SSH_ASKPASS=/whereveryouwant/my-ssh-askpass
export DISPLAY=:0
unset TERM
exec setsid /usr/bin/ssh $*

and where the my-ssh-askpass script will simply do :
#! /bin/sh
echo yourpreferredpassword

Hope this helps 🙂

Leave a Reply

Your email address will not be published.