Are SSH Keys or Passwords Better for SFTP Authentication? (2024)

Image

Are SSH Keys or Passwords Better for SFTP Authentication? (1)

SFTP passwords or SSH keys? That’s the question often asked by IT professionals when setting up authentication on an SFTP server. There’s some debate on whether SSH keys or passwords are better at protecting and validating company SFTP servers, and the consensus is never official.

Questioning what the best SFTP security best practice is doesn't have an easy answer. Both SSH keys and passwords have their advantages and disadvantages; it depends on what your organization needs and how strong your cybersecurity policy is.

Discover the Difference Between the Two

What are the real differences between these methods? How do they work? Is one really better or more secure than the other? Which is the best fit for your organization: SFTP with password or SSH keys?

SFTP Password Authentication

Authenticating an SFTP server with a password is simple. The administrator creates a username and password combination for a user. After the setup is complete, whenever the user signs in, the server checks the username/password combination and approves or denies the request based on whether the password is correct.

To make this method secure, the admin can enable a failsafe: if someone incorrectly tries the password more than X number of times in X minutes, they’ll be blocked from the account. The admin can also set passwords to meet certain requirements (i.e. a specific length or includes capitalized letters, numbers, and symbols) and expire after a certain number of daysthough whether this practice really prevents data breaches is still up for debate.

Pros: Easy to implement, can expire, can be assigned policies

Cons: Can be brute-forced, prone to human error and weak password creation, password policies may frustrate employees

SSH Key Authentication

Authenticating an SFTP server with a SSH key requires a little extra legwork, but it's a useful option for extra security. An SSH key pair is comprised of a private key and public key portion. The key pair is automatically generated by the computer and can be up to 4096 bits in length, which is much longer than a typical password.

You have a private key that’s kept on the SSH client software and a public key that’s kept on the SSH server.

Related Reading: Are SSH and SFTP the Same?

Once the public and private keys are stored, the client software can authenticate against the SSH server. Some SFTP servers require both an SSH key and password for additional authentication. Anyone who tries to login with the username or password (or both) but doesn’t have the correct private/public key match will be denied access to the server, regardless of whether they try to brute-force it.

Pros: Typically much more complex than a password, aren’t human generated, can have a password added for another factor of authentication, more complicated to brute-force than passwords

Cons: Don’t expire, prone to physical theft if someone takes the device they’re on, some key pairs are used across multiple SFTP servers which makes the private key valuable (and vulnerable)

Know Your Terms: GoAnywhere Glossary

So, Which Method is Better? SFTP with Passwords or SSH Keys?

Neither SSH keys nor passwords are completely immune to compromise. There’s no one option that’s foolproof. However, if you’re not sure which one to use, we recommend using SSH keys alongside a password to authenticate your users against an SFTP server. Many big companies (including GitLab) suggest using a password with your SSH key as best practice. IT forums like StackExchange often say the same.

Why You Should Use SFTP with Passwords and SSH Keys

The biggest argument for using both? If someone compromises your private key (i.e. steals your device or installs malware on it), they won’t be able to compromise the SFTP server without the password/passphrase. And if someone has your password but not your private key? Game over for them. Of course, this isn’t foolproof either, but it’s dual-factor authentication … which is a step above password-only for SFTP authentication.

GoAnywhere Managed File Transfer supports the use of SFTP to secure, automate, and audit file transfers. You can authenticate users with SFTP passwords and SSH keys, meaning you can choose one, the other, or both to satisfy your IT security requirements. With our SFTP client, you can also deliver and retrieve files from your SFTP server through an encrypted tunnel, transfer multiple encrypted files per connection, set up alerts for failed transfers, and more.

Watch an On-Demand DemoSchedule a Personalized Demo

Are SSH Keys or Passwords Better for SFTP Authentication? (2024)

FAQs

Are SSH Keys or Passwords Better for SFTP Authentication? ›

Neither SSH keys nor passwords are completely immune to compromise. There's no one option that's foolproof. However, if you're not sure which one to use, we recommend using SSH keys alongside a password to authenticate your users against an SFTP server.

Is SSH key based authentication better than password? ›

From a security standpoint, using SSH-keys to authenticate a user's identity leads to greater protection of your data. Username/password authentication can often lead to security compromises, in particular, brute force attacks by hackers.

Why an SSH Secure Shell key better than a SSH password? ›

The SSH key acts as a more secure and efficient alternative to traditional password-based authentication. This is because keys are less likely to be guessed or brute-forced compared to passwords. However, it is highly recommended to protect your private key with a passphrase.

What is the difference between SSH and SFTP keys? ›

SSH vs SFTP: Key Differences

SSH is designed primarily for secure remote command execution, while SFTP provides secure file transfer capabilities. In terms of security, both SFTP and SSH have equal firewall compatibility and security due to their shared protocol foundation.

Why are SSH keys recommended to use over usernames and passwords? ›

SSH key pairs offer a more secure way of logging into your server than a password that can easily be cracked with a dictionary and brute force attacks. SSH keys are very hard to decipher with these attacks.

What are the potential benefits of using public keys instead of passwords for SSH authentication? ›

2 Benefits of keys

Using keys for SSH authentication has several advantages over passwords. First, keys are more resistant to hacking, since they are harder to guess or steal than passwords. Second, keys can enable passwordless login, which saves time and avoids typing errors.

Which authentication verification type is most secure? ›

Most Secure: Hardware Keys

External hardware keys, like Yubikeys, are among the strongest authentication factors available.

Why are SSH Keys preferred? ›

Benefits of SSH Key Authentication

This means anyone eavesdropping on the traffic, such as by packet sniffing, would not be able to improperly access and decrypt transmitted data. SSH is also resistant to brute force attacks and protects against certain attack vectors used to gain access to remote machines.

What are the disadvantages of SSH? ›

SSH requires some software and settings to use, and it may not be compatible with some older or simpler devices. SSH also requires some knowledge and skills to use properly, such as generating and managing keys, choosing encryption algorithms, or troubleshooting errors.

Why is SSH key more secure? ›

Unlike symmetric encryption (which uses the same key to encrypt and decrypt), SSH key authentication employs asymmetric encryption algorithm, where the encryption and decryption use different keys. A user (or an authorised person) needs to generate both private key and a public key.

Do you need a SSH key for SFTP? ›

There's no one option that's foolproof. However, if you're not sure which one to use, we recommend using SSH keys alongside a password to authenticate your users against an SFTP server.

Can SFTP use SSH keys? ›

Your SSH keys can then serve as SFTP keys. Simply put, SSH keys and SFTP keys are the same. That said, file transfer solutions that offer SFTP do not necessarily provide SSH functionality.

Can I use SFTP without SSH? ›

SFTP cannot exist without SSH — SFTP uses SSH as the binding agent to transfer files securely. In other words, SSH protocol is used in the file transfer mechanism SFTP. In fact, most SSH servers include SFTP capabilities. However, not all SFTP servers support SSH commands and actions.

What is the difference between a key and a password? ›

Key vs password

Passwords are often created to be memorized by users and may contain non-random information such as dictionary words. On the other hand, a key can help strengthen password protection by implementing a cryptographic algorithm which is difficult to guess or replace the password altogether.

Should you password protect SSH keys? ›

With SSH keys, if someone gains access to your computer, the attacker can gain access to every system that uses that key. To add an extra layer of security, you can add a passphrase to your SSH key. To avoid entering the passphrase every time you connect, you can securely save your passphrase in the SSH agent.

How to use SSH key for SFTP authentication? ›

Create an sFTP connection using SSH keys:

Select the FTP connector from the list of connectors. Enter the Host URL of the FTP server, and select the sFTP protocol. Enter the username. Paste the RSA private key you generated into the Authentication Key (pem format) field.

Is SSH key based authentication Secure? ›

Public key authentication provides cryptographic strength that even extremely long passwords can not offer. With SSH, public key authentication improves security considerably as it frees the users from remembering complicated passwords (or worse yet, writing them down).

Is passwordless SSH more secure? ›

They are generally considered to be more secure than traditional passwords, as they cannot be guessed or stolen. Finally, physical tokens are also becoming increasingly popular for passwordless authentication. These are physical devices, such as key fobs or USB keys, that can be used to authenticate.

What is the difference between SSH password and SSH key pair? ›

SSH key authentication is also more convenient than password authentication. The keys connect users and processes to a server by initiating authentication and granting access automatically, so users don't have to remember or enter their password for each and every system.

Which authentication is better? ›

Two-Factor Authentication

This makes it much more difficult for someone to gain access to your account, even if they have your password. 2FA is not foolproof, but it is more secure compared to using only username and password. This makes it a valuable tool to help keep your account safe.

Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6620

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.