Previous: Getting Started
Next: Step 2 - Share your SSH public key with us
SSH authentication is widely regarded as the most secure and reliable method for accessing an SFTP server. It uses the Secure Shell (SSH) protocol to establish an encrypted connection, ensuring that data transferred between the client and server remains private and protected from interception. Unlike basic password authentication, SSH key-based authentication adds an extra layer of security by requiring a private key on the client side that matches a public key stored on the server. This eliminates the risk of brute-force attacks or stolen credentials, as the private key never gets transmitted. Additionally, SSH keys can be further secured with passphrases and are easier to automate safely in scripts and scheduled tasks, making them ideal for both human and system-level access. Overall, SSH authentication combines strong encryption, identity verification, and secure automation, making it the best practice for accessing SFTP servers.
These steps will help you generate a new SSH key pair using your terminal on Linux, macOS, or Windows
We will need only your public key (that is safe to share and helps us set up authentication). Your private key will also be created (and protected by the passkey) - keep it to yourself and never share it with anyone!
Run this command to see if you already have SSH keys:
Look for files like:
If you find them, proceed to Step 6: View your public key If not, continue reading ;)
Use the ssh-key command to generate a new SSH key pair:
Adding your_email@example.com is just the argument for -C, which allows you to specify the comment attached to the generated key. The comment is simply text appended to the key in your public key file, and is typically used as a label for your key.
The default comment is your username @ the hostname of the system you generate your key on, but it can be any string you wish.
You’ll be prompted:
⚠️ If the file exists, you’ll be asked to overwrite - only do this if you’re sure you want to do that!
You’ll see:
🔐 A passphrase protects your private key, you will need it to authenticate
At this point, you should have both your public and private keys created. Typically, your private key is the file without the extension (id_ed25519), while your public key has .pub as the file extension (id_ed25519.pub)
Whether you already had it or just created it, let’s quickly check if everything went well. Run:
(in case you changed the key file name, make sure to point to the correct file in your command instead of id_ed25519.pub)
You’ll see something like:
You can use this key on servers, services like GitHub or any other place that supports SSH authentication.
For our needs, you would need to share .pub file with us, so we import it on our SFTP server.
To see how to do that, proceed to the next step.
Next: Step 2 - Share your SSH public key with us