OpenSSH, take two
Today I had to re-generate my key files for OpenSSH authentication. Between August and now I had forgotten how exactly that is done. So for next time this happens, here are detailed step-by-step instructions:
1) plug FAT32-formatted USB stick into PC-BSD laptop; it will be automatically mounted as /media/fattie
2) from terminal window, do this:
% ssh-keygen -t dsa
keep default names (id_dsa, id_dsa.pub) and path (/usr/home/myusername/.ssh).
3) copy id_dsa.pub to the USB stick:
% cp /usr/home/my_laptop_username/.ssh/id_dsa.pub /media/fattie
4) move this file to the server; will have to mount the USB stick like so:
# mount_msdosfs /dev/da0s1 /mnt
5) overwrite this file onto the authorized_keys file:
# mv /mnt/id_dsa.pub /usr/home/my_server_username/.ssh/authorized_keys
6) unmount USB stick and you're done:
# umount /mnt
Now, to test the connection, get back to the laptop and connect from a terminal window:
% ssh my_server_username@myserver.homeip.net
And all is well. Now you need to set up the Windows XP laptop, both PuTTY (done it before) and Cygwin (that's a new one). Use same id_dsa private key for convenience, so while still on the PC-BSD laptop, plug the USB stick back in and copy the private key:
% cp /usr/home/my_laptop_username/.ssh/id_dsa /media/fattie
OK, on to the Windows laptop. Plug in the USB stick and do two things: first, use puttygen.exe to convert the id_dsa file into PuTTY's own .pkp format, so you can connect to the server with PuTTY. Second, save id_dsa as-is in the Cygwin .ssh folder (/home/my_Windows_username/.ssh) so you can connect from Cygwin as you would from the PC-BSD laptop, with the ssh command.