Several Tools You Might Need:
- MSYS Base System
- PuTTY
- Total Commander (with SFTP plugin)
Generating SSH2 Key-pair:
- Method A: simply issue ssh-keygen in MSYS shell
- Mehotd B: start PUTTYGEN.exe and click "Generate" button.
Method A is recommended because it creates Linux compatible key-pair files and stores the files to $(HOME)/.ssh. In case you don't use MSYS, please follow PuTTY manual for method B to complete SSH authentication with PUTTYGEN.
Setup PuTTY To Use SSH Authentication:
Import MSYS Keys Into PUTTYGEN:
- Conversions Menu > Import Key: import the "id_rsa" file under MSYS $HOME/.ssh
- Click "Save private key" button to save private key to a .ppk file (for PuTTY only)
- Click "Save public key" button to save a public key for PuTTY. (optional)
Config PuTTY:
- start a PuTTY instance (default session)
- browse to Connction > SSH > Auth > "Private key file for authentication"
- points to the .ppk file you just created in above step.
- browse to Session
- click "Default Settings"
- click "Save" button to save current config to your default settings.
Setup TotalCMD SFTP Plugin:
Create key files for SFTP plugin
- start puttygen.exe
- click "Load" buttong to load the .ppk file you created above
- Conversions Menu > Export OpenSSH Key: export a private key (.pem file) for Total Command SFTP plugin
- copy from "Public key for pasting into OpenSSH authorized_keys file"
- paste into a new file named "rsa.pub" (this file is actually same to rsa.pub under MSYS $HOME/.ssh)
Config TotalCMD SFTP Connection: TotalCMD help gives you more detail -- click the '?' button besides "Public key file".
- in TotalCMD, browse to Network Neighbor > Secure FTP
- press F7 to create new connection
- points to .pub file above for public key
- points to .pem file above for private key
Publish your public key to the remote server:
# simply issue below 2 lines of command in MSYS shell # both of the commands need you to input the password ssh <user>@<remote_host> mkdir -p .ssh cat .ssh/id_rsa.pub | ssh <user>@<remote_host> 'cat >> .ssh/authorized_keys' # now you can forget the password, try this: ssh <user>@<remote_host>
Check this article for more information