Use WinSCP to Login via SFTP without Password using Public Key & Private Key Pair

WinSCP (Windows Secure Copy) is a free and open-source SFTPFTPWebDAVAmazon S3 and SCP client for Microsoft Windows. Its main function is secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager and file synchronization functionality. For secure transfers, it uses Secure Shell (SSH) and supports the SCP protocol in addition to SFTP.

For creating private key and public, open winscp and run PuTTYgen.

PuTTYgen

Now click generate button to create private and public keys. Please generate some randomness by moving the mouse over the blank area.

If you want to secure your key with password, you can set key passphrase. That means, you need this password to unlock your keys. This is optional but recommended.

PuTTY Key Generator

Now save private key (example: privatekey.ppk )  and public key ( example: publickey.pub ). Please note that, the private key should be kept safe to avoid any misuse.

Now open publickey and copy the content as shown below:

Public Key

Copy this content and remove all new lines , as ssh server expect to be everything in a single line. Now connect to your server and open the file %username%/.ssh/authorized_keys

Now Paste the copied content from public key into this file as following:

Save this file and restart SSH service.

That’s all on the server side. Time to configure Winscp now.

Winscp Configuration
Advanced – Winscp

Provide here the private key, which you have downloaded before and save it. Now you can login in to your server without your server credentials.

Note: If you have enabled key passphrase during certificate creation, you have to provide it for successful login. 

Passphrase for key

mm

Anup Chhetri

IT system administrator

You may also like...

error: Content is protected !!