Setting up public key authentication

If your SSH client supports it, you can use public key authentication to log into Bitvise SSH Server. On Windows, we recommend Bitvise SSH Client, which has strong support for public key authentication, as well as password authentication, and Kerberos single sign-on in domain environments.

If you are new to public key authentication, we first suggest reading Public keys in SSH.

To set up public key authentication, you first need to generate a keypair on the client, or select one or more existing keypairs for use with client authentication. The procedure for generating the keypair depends on the client software being used:

  • If you are using Bitvise SSH Client, click the link titled Client key manager in the Login tab. You can generate, edit, import and export keypairs in the dialog box that pops up.
  • If you are using a different client, you need to follow its process for generating keypairs. For example, in OpenSSH, keypairs are generated using the ssh-keygen utility. Make sure to generate an SSH2 keypair (not SSH1). Use either the ECDSA, RSA, or DSA (DSS) algorithms. We recommend either ECDSA, or RSA with a size of 2048 bits or higher.

Once the keypair has been generated, you need to import the public key (not the whole keypair!) into the SSH Server.

SSH Public Key Subsystem

Recent Bitvise SSH Server and SSH Client versions support the SSH Public Key Subsystem. To import a public key into the SSH Server this way:

  • Use the SSH Client to connect to the SSH Server using the account for which you want to configure the public key.
  • Once connected, open Client key manager. Right-click on the keypair, and select Upload to server.
  • You should now be able to authenticate using this keypair.

You can also use this feature to manage keys in the SSH Server from the command line, using the spksc client included with Bitvise SSH Client.

Import Public Key via File

With most clients, you can export the public key into a file, transfer the file to the SSH Server, and import it into SSH Server settings. In this case:

  • Export the public key in either the standard SSH2 public key format, or in the OpenSSH format. If you are using OpenSSH, the public key file can be exported from an existing keypair using the ssh-keygen utility (consult 'man ssh-keygen').
  • Once your public key file has been exported, transfer it to the machine where Bitvise SSH Server is installed, or a machine from which you manage the SSH Server remotely using Bitvise SSH Client.
  • Use either Easy SSH Server settings (screenshot) or Advanced settings (screenshot) to import the public key into the SSH user's account settings entry.

Common mistakes: Make sure that you don't try to import the client's key into the server's host key management interface. The host key management interface is accessed directly from the "Server" tab of the Bitvise SSH Server Control Panel, and is intended to manage keypairs that authenticate the server. These keypairs are separate and unrelated to client authentication.

Synchronization with authorized_keys

For Windows accounts, the SSH Server also supports synchronization with ~/.ssh/authorized_keys. This feature must be enabled in Advanced SSH Server settings, under Access control. It allows Windows users to upload their SSH public key to a file named authorized_keys under a subdirectory named .ssh under the user's Windows profile directory. If this setting is enabled, the SSH Server will check for the existence of the authorized_keys file when the user logs out. If the file exists, the SSH Server will replace all of the public keys configured for the user with keys found in this file.

Use this feature with caution: if your system has unused authorized_keys files laying around, this may cause public keys to be unexpectedly deleted.