Login securely from Windows to Linux using FastX Client or X-Win32
Secure and convenient method to authenticate using an SSH public key along with pageant.exe.
- Download and install Putty (https://www.putty.org/).
- Run the “PuTTYgen” program.
- Click “Generate”. Follow instructions.
- Give the key a better name, and enter a passphrase. (You will enter this passphrase every time you log into your Windows computer.)
- Click “Save private key”. Save it somewhere you can find it later, recommend using your Documents folder.
- Click in the box near the top, under the text that says: “Public key for pasting into OpenSSH authorized_keys file.”
- Right-click, Select All, right-click, Copy. (Keep this in your clipboard for step 12)
- Launch PuTTY.
- Enter the hostname of your Linux server, and click “open”.
- Log into your Linux server.
- At the Linux prompt, type:
mkdir .ssh
thentee -a .ssh/authorized_keys
- Click the right mouse button. This should paste the text you copied to your clipboard earlier.
- Press Enter, then Control-D.
- Check the permissions on your .ssh directory and the authorized_keys file. They should not be writable by anyone but you. If they are, type
chmod og-w .ssh .ssh/authorized_keys
. (Or just type it anyway, so you don’t need to check.) - Log out of the Linux system.
- Close PuTTYgen (PuTTY Key Generator).
- In Windows, open “Documents”, or the directory you saved your private key in step 5.
- Hold the Windows key down, and type “R” (Windows-R).
- In the box that appears, type
shell:startup
. This will bring up a second folder named “Startup”. Leave both “Documents” and “Startup” open. We will use them both. - In the “Documents” folder, right-click on the file you saved in step 5, and select “Create shortcut”.
- Drag this shortcut into the “Startup” folder. You may then rename it, if you like.
Testing Login
- Log out (or shutdown) Windows. Then log back in.
- After you log in, a window should appear that says “Enter passphrase to load key …”. Enter the passphrase you created in step 4 above. You will not have to enter this passphrase again until you log back in to your Windows system.
- Launch the FastX client or X-Win32. If you have created a connection and saved a password in it, edit the connection and remove the password.
- From FastX or X-Win32, launch the SSH connection to your Linux system. It should connect without asking for a password.