Skip to content

Password Hashing

SFTPGo hashes passwords before storing them in the data provider. By default, the bcrypt algorithm is used.

Preferred algorithm

The preferred hashing algorithm can be configured in the data_provider.password_hashing section of the configuration file. Supported algorithms for new passwords:

  • bcrypt (default) — prefix $2a$. Configurable cost parameter (default: 10).
  • argon2id — prefix $argon2id$. Configurable memory, iterations, and parallelism.
  • pbkdf2-sha256 — prefix $pbkdf2-b64salt-sha256$. PBKDF2 with HMAC-SHA256 and a random salt. Configurable iteration count (default: 600000) and salt length (default: 16 bytes, valid range 16--64).

When users log in, if their password is stored with a different algorithm than the preferred one, SFTPGo automatically re-hashes it with the preferred algorithm. This upgrade happens transparently; the user does not need to change their password. The same transparent upgrade applies to administrator and share passwords at their next successful verification. API keys keep the format they were generated with: generate a new key to adopt the preferred algorithm.

Supported formats

In addition to the preferred algorithm, SFTPGo can verify passwords stored in many other formats. This allows migrating users from other systems (such as Linux /etc/shadow, Apache htpasswd files, LDAP directories, or other SFTP/FTP servers) by importing their existing password hashes directly into SFTPGo. Users can log in immediately with their current passwords, and at first login SFTPGo will automatically re-hash each password using the preferred algorithm.

Format Prefix
bcrypt $2a$, $2b$, $2y$
argon2id $argon2id$
PBKDF2-SHA1 $pbkdf2-sha1$
PBKDF2-SHA256 $pbkdf2-sha256$
PBKDF2-SHA512 $pbkdf2-sha512$
PBKDF2-SHA256 (base64 salt) $pbkdf2-b64salt-sha256$
MD5-Crypt $1$
MD5-Crypt (APR1) $apr1$
SHA256-Crypt $5$
SHA512-Crypt $6$
yescrypt $y$
MD5 digest {MD5}
SHA1 digest {SHA1}
SHA256 digest {SHA256}
SHA512 digest {SHA512}
Salted SHA1 digest {{SHA1}}
Salted SHA256 digest {{SHA256}}

The salted digests carry their own salt: the prefix is followed by the base16 encoded salt concatenated with the digest of the salt and the password. SFTPGo derives the salt length from the digest size, so salts of any length are supported. Some third-party SFTP/FTP servers store passwords in this format.

LDAP directories store the hash after a scheme name in braces. For the {CRYPT} scheme, import the value that follows the scheme name: it is one of the crypt formats in the table. A 389 Directory Server {PBKDF2_SHA256} hash is the base64 encoding of the iteration count (4 bytes, big-endian), the 64-byte salt and the derived key: import it as $pbkdf2-b64salt-sha256$<iterations>$<base64 salt>$<base64 key>.

An administrator with the * permission can set a password with one of these prefixes: it is not re-hashed, SFTPGo stores it as-is and verifies it using the corresponding algorithm. For other administrators, role administrators included, the save fails with a validation error: a tenant administrator who needs to import hashes from another system asks an administrator with the * permission. Backups and the initial data are restored as they are. A password a user chooses, when changing or resetting it or for a share, and the password an administrator chooses for itself are always hashed, even if they start with one of these prefixes.

A plain-text password cannot be longer than 255 characters, 72 bytes with bcrypt. Imported hashes are not subject to this limit.

Password caching

Verifying bcrypt, argon2id, and pbkdf2-sha256 hashes is computationally expensive. SFTPGo caches verified passwords in memory to reduce CPU usage on repeated logins. Caching is enabled by default and can be disabled via the data_provider.password_caching configuration option.

Password validation

Password strength rules are validated every time a password is set or changed — when an administrator creates or updates a user, when the user changes their own password, on password reset, and when a share is created or updated with a password.

Available rule types:

  • Entropy-based — evaluates overall cryptographic strength (min_entropy at system level, password_strength on users and groups). This is the recommended approach.
  • Character rules (password_policy) — minimum length, uppercase, lowercase, digits, and special characters.

Admin passwords

Admin accounts do not have per-admin password fields. The data_provider.password_validation.admins.* values in the configuration file are the enforced minimum — every admin password must satisfy them, with no way to override them per admin.

Protocol user and share passwords

For protocol users (and passwords set on shares), rules can be defined at three levels, with the following precedence (highest first):

  1. Per user — password_strength and password_policy on the user record (Filters section).
  2. Primary group — the same fields on the primary group's user settings. Each field is taken from the primary group when the user's corresponding field is 0/empty. Secondary groups are not considered for password policy.
  3. System default — data_provider.password_validation.users.* in the configuration file. min_entropy applies when the resulting password_strength is 0; the character rules apply as a set when the resulting password_policy has no rule set.

⚠ For protocol users, the system-level values are defaults, not a floor. A value set on a user or on its primary group replaces them, including with a weaker one, so an administrator can relax the rules for service accounts or legacy integrations. The fields are part of the user and group definitions: every administrator allowed to create or edit users and groups can set them. Where a minimum must hold for every protocol user, grant those permissions to trusted administrators and review the values the users and groups carry.

⚠ All rules are disabled by default (value 0), meaning any password is accepted. It is strongly recommended to configure at least a system-level default so admins and users without per-entity settings are still protected.