Generate Openssh Public Key Windows
Copying the public key securely. The OpenSSH tools include the SCP and SFTP utilities to make transferring keys completely secure. In order to properly configure a Windows client for authenticating via SSH keys, the public key (.PUB) file must be transferred to the client device’s.ssh directory and stored in the authorizedkeys text file. Save the text file in the same folder where you saved the private key, using the.pub extension to indicate that the file contains a public key. If you or others are going to use an SSH client that requires the OpenSSH format for private keys (such as the ssh utility on Linux), export the private key: On the Conversions menu, choose Export. Type in the passphrase and confirm it. The passphrase is used to protect your key. You will be asked for it when you connect via SSH. Click 'Save private key' to save your private key. Click 'Save public key' to save your public key. For more information on how to load the key and connect via SSH using PuTTY, please check this tutorial. SSH, the secure shell, is often used to access remote Linux systems. But its authentication mechanism, where a private local key is paired with a public remote key, is used to secure all kinds of online services, from GitHub and Launchpad to Linux running on Microsoft’s Azure cloud. Generating these keys from Linux is easy, and thanks to Ubuntu on Windows, you.
Jun 26, 2019 ssh-keygen -b 4096 The -b flag instructs ssh-keygen to increase the number of bits used to generate the key pair, and is suggested for additional security. Press Enter to use the default names idrsa and idrsa.pub in the /home/yourusername/.ssh directory before entering your passphrase. Generating public/private rsa key pair. Enter file in which to save the key (/home/yourusername/.ssh. Click Generate to generate a public/private key pair. As the key is being generated, move the mouse around the blank area as directed. (Optional) Enter a passphrase for the private key in the Key passphrase box and reenter it in the Confirm passphrase box.
This guide contains description of setting up public key authentication for use with WinSCP. You may want to learn more about public key authentication or SSH keys instead.
- Configure Server to Accept Public Key
Advertisement
Before starting you should:
- Have WinSCP installed;
- Know how to connect to the server without public key authentication.
If you do not have a key pair yet, start with generating new key pair.
Connect to your SSH server using WinSCP with the SSH protocol, using other means of authentication than public key, e.g. typically using password authentication.
Once logged in, configure your server to accept your public key. That varies with SSH server software being used. The most common SSH server is OpenSSH.
You can use Session > Install Public Key into Server command on the main window, or Tools > Install Public Key into Server command on SSH > Authentication page page on Advanced Site Settings dialog. The functionality of the command is similar to that of OpenSSH ssh-copy-id
command.
Or you can configure the key manually:
- Navigate into a
.ssh
subdirectory of your account home directory. You may need to enable showing hidden files to see the directory. If the directory does not exists, you need to create it first. - Once there, open a file
authorized_keys
for editing. Again you may have to create this file, if this is your first key. - Switch to the PuTTYgen window, select all of the text in the Public key for pasting into OpenSSH authorized_keys file box, and copy it to the clipboard (
Ctrl+C
). Then, switch back to the editor and insert the data into the open file, making sure it ends up all on one line. Save the file. WinSCP can show you the public key too. - Ensure that your account home directory, your
.ssh
directory and fileauthorized_keys
are not group-writable or world-writable. Recommended permissions for.ssh
directory are700
. Recommended permissions forauthorized_keys
files are600
. Read more about changing permissions.
- Save a public key file from PuTTYgen, and copy that into the
.ssh2
subdirectory of your account home directory. - In the same subdirectory, edit (or create) a file called
authorization
. In this file you should put a line likeKey mykey.pub
, withmykey.pub
replaced by the name of your key file.
For other SSH server software, you should refer to the manual for that server.
When configuring session, specify path to your private key on SSH > Authentication page of Advanced Site Settings dialog.
Alternatively, load the private key into Pageant.
Cloud providers have typically their own mechanism to setup a public key authentication to virtual servers running in the cloud.
For details see guides for connecting to:
- Amazon EC2;
- Google Compute Engine;
- Microsoft Azure.
Generate Openssh Public Key Windows 8
- Using Public Keys for Authentication;
- Using PuTTYgen;
- Understanding SSH Key Pairs.