Distributing private keys for SFTP servers

A common method of authenticating users in SFTP servers such as CompleteFTP is public key authentication.

In public key authentication, what is called a key pair is used, consisting of two related cryptographic keys: the public key and the private key. The special property of any key pair is that data encrypted with one can only be decrypted with the other.

When the SSH or SFTP server asks the client to authenticate, the client uses the private key to encrypt some data that is already known by the server (e.g. the user-name); the client sends the encrypted data back to the SFTP server; the server decrypts it with the public key. If the decrypted data matches the known data then it can only have been encrypted with the private key. The SFTP server thereby knows that the client has possession of the private key and permits access.

It is crucial that the private key is kept confidential to the user, as anyone in possession of it can authenticate as that user. This might seem risky, but it is preferable to the use of passwords. Passwords can be guessed, while private keys are large enough that they cannot be. Also, the private key is never sent across the network, while passwords are, making them more vulnerable to attack.

Email & phone call are not safe for distributing private keys for SFTP servers:

The main problem is private key distribution. How can server administrators get users' private keys to them safely? Email is obviously not a safe transmission medium, and they cannot be communicated using a phone call.

Solution for distributing private keys for SFTP server:

The solution is to get users to generate their private keys themselves. The SFTP server needs their public key, but this can be safely sent by the user via email provided the user confirms it by other means. For example, the user could confirm certain characters in the public key with a phone call, or calculate a hash of the public key and recite the characters.

sftp server/s