You can automatically log in to a Linux server on Windows using PuTTY by making use of a key file. Below I explain step by step how to do this.
- Create a key: start: puttygen.exe
- Click on: Generate
- Click on: Save private key
- Go to PuTTY Configuration -> Session
- Load a previously created session or create a new one
- Go to: Connection -> SSH -> Auth -> Private key file for authentication -> Browse
- Select your file with the private key: *.ppk
- Go back to Session and click on: Save
- Log in to the Linux server using the Saved Sessions and still with your password
- Create a new directory in the home directory: .ssh
- Give this directory the correct permissions: chmod 700 ~/.ssh
- Create and edit the file authorized_keys: vi ~/ssh/authorized_keys
- Copy the Public key for pasting from the PuTTY Key Generator
- Paste it into the authorized_keys file on the Linux server
- Save the authorized_keys file (for vi type: :wq)
- Give this file the correct permissions: chmod 600 ~/.ssh/authorized_keys
- Close the logged-in PuTTY session to the Linux Server
- Open the session again to verify that you can now log in automatically
