- Name: SWeidner
- Location: Elk Point, South Dakota, United States
My Blogger Code
B5 d+ t k s u- f- i- o- x-- e l- c (decode it!)
My Geek Code
GAT/IT d-(+) s+(): a C+++$ ULC+++>$ P++>++++ L++$>++++ !E W++>$ N+ !o !K w+()@ !O !M- !V PS-(--)@>--- PE+ Y-- PGP>++ t+ !5(-) X+ !R- tv-(+)? b+ DI++++ D++>$ G e+>++ h----(-) r+++ y++++
Steve's random ramblings and technical notes
Thursday, June 09, 2005
SSH - Automagic Login HowTo
You might be thinking, "Why would I need to do this, can't you just type a password?" Well sure, that's what I've been doing for years. My need for automation on this box is for daily backup of documents from one machine to another using Unison.
Of course, there is documentation in Unison that mentions the ability to do an automatic login but it doesn't give a lot of details (and in fact, other sites just mention that it's difficult and leave it at that).
Now I, never being one to shirk a challenge, decided to give it a go and write down all the nitty-gritty details so others would be able to get their login working much more quickly. I'll assume you're familiar with downloading, moving and renaming files in both Windows and Linux. These steps were done on machines running Windows XP and TinySofa Enterprise Server. So hold on to your hat, here goes... (and remember YMMV)
- Download the required software to each machine:
- Install OpenSSH on your Windows machine (you don't need to start the SSH server for this procedure)
- I already had a newer version of cygwin1.dll in my path, so I copied the following files to that directory (c:\bin) to avoid an error regarding multiple cygwin1.dll versions.
- copy unison-2.12.15-win-text.exe c:\bin\unison.exe
- bunzip2 unison-2.12.15-linux-text.bz2
- chmod +x unison-2.12.15-linux-text
- cp unison-2.12.15-linux-text /usr/local/bin/unison To verify that it's the first copy in your path, type "unison -version" and make sure the version reported is what you just installed.
- ssh-keygen -b 1024 -t rsa -f "key-filename"
- cat "key-filename"
.pub >> .ssh/authorized_keysthis appends the new key to your authorized_keys file or creates it if needed
- sshargs = -l your_username -i c:\path\to\your\key\"key_filename"
Note, I tried generating the ssh-key with Putty keygen on the Windows machine, but it apparently didn't format the public key correctly for the authorized_keys file. However, after removing carriage-returns and adding "ssh-rsa" to the beginning and my username to the end of the appropriate line, I was able to use the key generated by Putty. Each key should be just one line in the authorized_keys file and its format looks like
ssh-rsa some-long-and-seemingly-random-sequence-of-characters= email@example.com spaces before and after the actual key.
Update: 7/21/2005 - I found a related troubleshooting page here.