Setting up kmail over ssh ******** locla host shell ******** local host: for ssh using protocoll 1 ssh-keygen will create a public/private rsa1 key pair for ssh using protocoll 2 ssh-keygen -t rsa will create a public/private rsa key pair ssh-keygen -t dsa will create a public/private dsa key pair using a passphrase is strongly recommanded, but will need some more changes in the KDE-Setup. copy the file ~/.ssh/id_rsa.pub to your account on the remote hosts and add the content of this file to ~/.ssh/authorized_keys or authorized_keys2 depending on the version of ssh running there. localhost scp ~/.ssh/id_rsa.pub @: *********************************** setting up KDE to use ssh-agent: a) for your account only in ~/.xsession (on SuSe 8.0) change usessh="no" to usessh="yes" make sure that .xsessions contains this or similar code # # Run ssh-agent only if ssh is configured and avaliable. # sshagent="no" if test "$usessh" = "yes" -a -d $HOME/.ssh ; then type ssh-agent > /dev/null 2>&1 && sshagent="yes" fi if test -f $HOME/.xinitrc ; then if test "$sshagent" = "yes" ; then exec ssh-agent $HOME/.xinitrc else exec /bin/bash $HOME/.xinitrc fi # create a file ~./.ssh-add.sh --------------------------------------- #!/bin/sh if [ -f ~/.ssh/id_rsa ] then echo '***********************' echo "Passphrase for identity" ssh-add ~/.ssh/identity echo "***********************" fi if [ -f ~/.ssh/id_rsa ] then echo "***********************" echo "Passphrase for rsa" ssh-add ~/.ssh/id_rsa echo "***********************" fi if [ -f ~/.ssh/id_dsa ] then echo "***********************" echo "Passphrase for dsa" ssh-add ~/.ssh/id_dsa echo "***********************" fi --------------------------------------- create a desktopfile ~./kde[3]/Autostart/ssh-add to automaticaly start the passphrase dialog. --------------------------------------- [Desktop Entry] Comment[en_US]= Encoding=UTF-8 Exec='~/.ssh-add.sh' GenericName[en_US]= Icon= MimeType= Name[en_US]=Add passphrase Path= ServiceTypes= SwallowExec= SwallowTitle= Terminal=true TerminalOptions= Type=Application X-KDE-SubstituteUID=false X-KDE-Username= --------------------------------------- b) system wide ******* kmail local host *********************** in kmail - Settings - Network - Receiving account enter the following command as precommand (all on one line) ssh -v -f -L 11110:localhost:110 \ @ sleep 10 Host = localhost Port = 11110 ******** remote host *************************** remote host: login to the remote host ssh @ cat identity.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys or cat id_rsa.pub >> ~/.ssh/authorized_keys2 chmod 600 ~/.ssh/authorized_keys2 ************************************ Restart KDE The passphrase will be asked Check your mail BTW other ssh tunnels can be established now very easily * ssh @ opens a secure shell to the remote host * scp @:/tmp will copy the local file to the /tmp directory on the remote host * ssh -v -f -N -L 11180:localhost:80 @ allows to connect to the remote http server calling http://localhost:11180/ End of document