Setup
- Download and install cygwin with the openssh and the keychain package
- Run cygwin
- Enter in the terminal:
- ssh-keygen -t rsa
- choose some password, and enter it again to confirm
- vi ~/.bashrc and put this at the button of the file:
source ~/.keychain/${HOSTNAME}-sh
Usage
To get be able to log in to the remote machine, simply append the contents of your local ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys on the remote machine (create the file on the remote machine if it does not exist). *If the authorized_keys file doesn't exist, create it and make sure that the permission is at least 700!
Config
If you typically ssh using another user, or want to setup an alias to be able to quickly ssh somewhere, you can configure ssh to do this. Simply vi ~/.ssh/config (create the file if it doesn't exist) and model your entries after the following:
Host server
Hostname server.fully.qualified.name
User admin
Now to be able to ssh into server.fully.qualified.name as the admin user, simply type in:
ssh server
whereas before you had to type inssh admin@server.fully.qualified.name
3 comments:
Typically you want the .ssh directory permissions to be 700 (drwx------) and the public key (.pub file) to be 644 (-rw-r--r--). Your private key (id_rsa) should be 600 (-rw-------).
On the newest version of cygwin that I'm using 1.7.16, I had to instead include:
#notice no .pub after id_rsa
keychain ~/.ssh/id_rsa
source ~/.keychain/${HOSTNAME}-sh
I also got ~/.ssh/authorized_keys to work with permissions of 644 as well.
Post a Comment