{"kind": "auth", "major": "18", "item": {"slug": "md5", "name": "md5", "name_zh": "", "category": "Password authentication", "summary": "Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to Section 20.5 for details about migrating to another password type.", "aliases": [], "content_hash": "be5a8e17622db76eaa08567734485391dc8106ee477f8762aa2973bcf506fa6c", "versions": {"10": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "revision": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9", "catalog_fingerprint": "691be281b476dde4374d7f805b2bacc2e75bdef40f1e9d3d42e91f97fe95cfd0"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, {"url": "/docs/10/auth-methods.html#AUTH-PASSWORD", "path": "auth-methods.html", "label": "PostgreSQL 10 English manual", "sha256": "856d36a3fdfe8c45a25832e49bd07e9b7480f2ff9a33e58ac7c392630149bc34"}, {"url": "/docs/10/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 10 English manual", "sha256": "04fed609a50e8fd3013ffebb83039c544d39b6c73a6c2b2e23cd7864a70b42da"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.3.2 for details."], "manual_html": "<div class=\"sect2\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h3 class=\"title\">20.3.2.\u00a0Password Authentication</h3>\n</div>\n</div>\n</div>\n\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://tools.ietf.org/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/10/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/10/sql-createuser.html\" title=\"CREATE USER\"><span class=\"refentrytitle\">CREATE USER</span></a> and <a class=\"xref\" href=\"/docs/10/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE USER foo WITH PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/10/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/10/auth-methods.html#AUTH-PASSWORD", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "11": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "revision": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0", "catalog_fingerprint": "8f21f4444b7f68923f4762af0eb7937fa2907026e91249483e79050de012c901"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, {"url": "/docs/11/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 11 English manual", "sha256": "06b509f1ece73d71706f82a9287080f645cf29152dfe38a3063d9640ccea54a5"}, {"url": "/docs/11/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 11 English manual", "sha256": "5477c61a002171f5b4c462052d91231c405f39d89d825faf71e52fbae358eef7"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication</h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://tools.ietf.org/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/11/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/11/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/11/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/11/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/11/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "12": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "revision": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b", "catalog_fingerprint": "9f857f4ee4875f9c7de6bfc9df4b757dec8b3a0bb88eadb519c7bd267bd56149"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, {"url": "/docs/12/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 12 English manual", "sha256": "e1fba06a81ce077a266c8852e9090a4a1521207479d17e24a55068099fb9eb65"}, {"url": "/docs/12/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 12 English manual", "sha256": "07e8cddcb38076c86dab95b72c4380a7a325f22401b5b7f9af5dd4931876f2cb"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication</h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/12/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/12/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/12/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/12/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/12/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "13": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "revision": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6", "catalog_fingerprint": "c7015c845255c9d721c547c8ab9ef37825d332588c9691d982e6906b7d571002"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, {"url": "/docs/13/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 13 English manual", "sha256": "7dc40d4c26e2dbb20902a9b975ba37437baf8433804400191badd8487fe0eab6"}, {"url": "/docs/13/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 13 English manual", "sha256": "3cc6ce851945cba450e6b26ecf9cae1efd3c03fb7b55e17876f4d9ea418a7c2e"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication</h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/13/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/13/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/13/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/13/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/13/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "14": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "revision": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897", "catalog_fingerprint": "b272e6a82e4c46efda81c3a6a4cdf7de6a83dfff7f02f226a392fbe9acdd3adb"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, {"url": "/docs/14/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 14 English manual", "sha256": "fc4a9c1cae83361299edd3c455f2c74b08be1999411c7c7beeab07ffe27c72b1"}, {"url": "/docs/14/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 14 English manual", "sha256": "c9a75f04fd4a1069ea261ba061578a75c47a4b7e0bbf88761502fd4c19ccbc3f"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 21.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">21.5.\u00a0Password Authentication</h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/14/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/14/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/14/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/14/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/14/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "15": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "revision": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89", "catalog_fingerprint": "fefe3c425147a86defada190c9b0663cfe02caa1724f5dede93e46457572252d"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, {"url": "/docs/15/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 15 English manual", "sha256": "db530ef64e642d0f0ec06159d6cf49973161d0ebb40ef5700f8e1b64093ee2f2"}, {"url": "/docs/15/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 15 English manual", "sha256": "0470cd3eeb82cbc32d4b8b79e29f4427bdfd01f5bb15e6d9b7cee2f6dd2bba44"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 21.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">21.5.\u00a0Password Authentication</h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/15/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/15/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/15/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/15/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/15/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "16": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. The md5 method cannot be used with the db_user_namespace feature. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "revision": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed", "catalog_fingerprint": "fa133458dc8f52e15083b4f59b7a582e2e378b608d3ac5c53054df458a374e23"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, {"url": "/docs/16/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 16 English manual", "sha256": "1e33b5a05b349634266e1e433229d99ff7476113634574cf861c050039e7cead"}, {"url": "/docs/16/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 16 English manual", "sha256": "ccc5146375a184646d5992edbc693e12c0de4431a35141d6b56c8dd6b3c52132"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 21.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">21.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>The <code class=\"literal\">md5</code> method cannot be used with the <a class=\"xref\" href=\"/docs/16/runtime-config-connection.html#GUC-DB-USER-NAMESPACE\">db_user_namespace</a> feature.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/16/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/16/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/16/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/16/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "17": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "revision": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979", "catalog_fingerprint": "4bbe3ac77becd618478f66aec420a533e9017be356c5c1d51a4b17f0fd497c07"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, {"url": "/docs/17/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 17 English manual", "sha256": "8c8ce306f8374b07ecb4ff1437de39d401e20243db1dacd3ac898d5478e530a1"}, {"url": "/docs/17/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 17 English manual", "sha256": "00c7a7c25d46aa1b2f24cd744cd4990ca4218cfafed2a4cab8c1dc1092090bba"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/17/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/17/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/17/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/17/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "18": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to the text below for details about migrating to another password type."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "revision": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f", "catalog_fingerprint": "65c93d6048ef30e61023a84f9680fa6a92b1c383b7eb226741170077eb078502"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, {"url": "/docs/18/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 18 English manual", "sha256": "89d87aa104ffde4d6ddb753032794cc5924db149179845d97788e0999e0971c1"}, {"url": "/docs/18/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 18 English manual", "sha256": "6340d4abea2e0a3482afc31bcd1599a0fa10dc28a6f1e05d79ba831e2dd0b4c9"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to Section 20.5 for details about migrating to another password type."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Support for MD5-encrypted passwords is deprecated and will be removed in a future release of <span class=\"productname\">PostgreSQL</span>. Refer to the text below for details about migrating to another password type.</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/18/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "19": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to the text below for details about migrating to another password type."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "revision": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86", "catalog_fingerprint": "62fbf1a3689dbe8bf7e6b3372cfe6fbf867581427b3858a94c8419b77a4d2d1d"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, {"url": "/docs/19/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 19 English manual", "sha256": "12a5a4b63b1571e98cdb62cd55570bb7947cbf2c218c6a8415eb75c382c9c652"}, {"url": "/docs/19/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 19 English manual", "sha256": "d05e9155d5388148c2c680ff208b62c6b3b0b1c30f302ada5ab4befec36c19b7"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to Section 20.5 for details about migrating to another password type."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Support for MD5-encrypted passwords is deprecated and will be removed in a future release of <span class=\"productname\">PostgreSQL</span>. Refer to the text below for details about migrating to another password type.</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/19/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/19/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/19/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/19/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "20": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to the text below for details about migrating to another password type."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "revision": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "catalog_fingerprint": "398fbb9f262264053c02fbf79f88be0a6770c1473faa6ecd5931d6ec41b8258b", "source_snapshot_utc": "26-Sep-2026 20:22"}, "sources": [{"url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, {"url": "/docs/devel/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 20 English manual", "sha256": "a3d794d9f8f9fc8fb0afefa23dfb23ef9476bc8acc0305d7478a1f81aca822e1"}, {"url": "/docs/devel/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 20 English manual", "sha256": "cf2069461da3eec62f6fb4e3df8e46fd69ff4b3a2ad059eec355cee256d7996e"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to Section 20.5 for details about migrating to another password type."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Support for MD5-encrypted passwords is deprecated and will be removed in a future release of <span class=\"productname\">PostgreSQL</span>. Refer to the text below for details about migrating to another password type.</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/devel/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/devel/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/devel/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/devel/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}}}, "snapshot": {"facts": [{"label": "Method", "value": "md5"}, {"label": "Configuration", "value": "pg_hba.conf"}, {"label": "Inventory", "value": "User-visible source authentication method"}], "tables": [{"key": "method-options", "rows": [{"name": "scram-sha-256", "description": "The method scram-sha-256 performs SCRAM-SHA-256 authentication, as described in RFC 7677 . It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure. This is the most secure of the currently provided methods, but it is not supported by older client libraries."}, {"name": "md5", "description": "The method md5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks. To ease transition from the md5 method to the newer SCRAM method, if md5 is specified as a method in pg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to the text below for details about migrating to another password type."}, {"name": "password", "description": "The method password sends the password in clear-text and is therefore vulnerable to password \u201c sniffing \u201d attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then password can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL)."}], "title": "Documented method options and alternatives", "columns": [{"key": "name", "label": "Option or term"}, {"key": "description", "label": "Meaning"}]}], "aliases": [], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "revision": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f", "catalog_fingerprint": "65c93d6048ef30e61023a84f9680fa6a92b1c383b7eb226741170077eb078502"}, "sources": [{"url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "Matching PostgreSQL source archive", "sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, {"url": "/docs/18/auth-password.html", "path": "auth-password.html", "label": "PostgreSQL 18 English manual", "sha256": "89d87aa104ffde4d6ddb753032794cc5924db149179845d97788e0999e0971c1"}, {"url": "/docs/18/auth-pg-hba-conf.html", "path": "auth-pg-hba-conf.html", "label": "PostgreSQL 18 English manual", "sha256": "6340d4abea2e0a3482afc31bcd1599a0fa10dc28a6f1e05d79ba831e2dd0b4c9"}], "sections": [], "signature": "", "attributes": {"method": "md5", "inventory": "User-visible source authentication method", "configuration": "pg_hba.conf"}, "description": ["Perform SCRAM-SHA-256 or MD5 authentication to verify the user's password. See Section 20.5 for details. Warning Support for MD5-encrypted passwords is deprecated and will be removed in a future release of PostgreSQL . Refer to Section 20.5 for details about migrating to another password type."], "manual_html": "<div class=\"sect1\" id=\"AUTH-PASSWORD\">\n<div class=\"titlepage\">\n<div>\n<div>\n<h2 class=\"title\">20.5.\u00a0Password Authentication </h2>\n</div>\n</div>\n</div>\n<p>There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">scram-sha-256</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">scram-sha-256</code> performs SCRAM-SHA-256 authentication, as described in <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc7677\">RFC 7677</a>. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.</p>\n<p>This is the most secure of the currently provided methods, but it is not supported by older client libraries.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">md5</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">md5</code> uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.</p>\n<p>To ease transition from the <code class=\"literal\">md5</code> method to the newer SCRAM method, if <code class=\"literal\">md5</code> is specified as a method in <code class=\"filename\">pg_hba.conf</code> but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Support for MD5-encrypted passwords is deprecated and will be removed in a future release of <span class=\"productname\">PostgreSQL</span>. Refer to the text below for details about migrating to another password type.</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">password</code></span></dt>\n<dd>\n<p>The method <code class=\"literal\">password</code> sends the password in clear-text and is therefore vulnerable to password <span class=\"quote\">\u201c<span class=\"quote\">sniffing</span>\u201d</span> attacks. It should always be avoided if possible. If the connection is protected by SSL encryption then <code class=\"literal\">password</code> can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).</p>\n</dd>\n</dl>\n</div>\n<p><span class=\"productname\">PostgreSQL</span> database passwords are separate from operating system user passwords. The password for each database user is stored in the <code class=\"literal\">pg_authid</code> system catalog. Passwords can be managed with the SQL commands <a class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"><span class=\"refentrytitle\">CREATE ROLE</span></a> and <a class=\"xref\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>, e.g., <strong class=\"userinput\"><code>CREATE ROLE foo WITH LOGIN PASSWORD 'secret'</code></strong>, or the <span class=\"application\">psql</span> command <code class=\"literal\">\\password</code>. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.</p>\n<p>The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameter <a class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION\">password_encryption</a> at the time the password is set. If a password was encrypted using the <code class=\"literal\">scram-sha-256</code> setting, then it can be used for the authentication methods <code class=\"literal\">scram-sha-256</code> and <code class=\"literal\">password</code> (but password transmission will be in plain text in the latter case). The authentication method specification <code class=\"literal\">md5</code> will automatically switch to using the <code class=\"literal\">scram-sha-256</code> method in this case, as explained above, so it will also work. If a password was encrypted using the <code class=\"literal\">md5</code> setting, then it can be used only for the <code class=\"literal\">md5</code> and <code class=\"literal\">password</code> authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous PostgreSQL releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalog <code class=\"literal\">pg_authid</code>.</p>\n<p>To upgrade an existing installation from <code class=\"literal\">md5</code> to <code class=\"literal\">scram-sha-256</code>, after having ensured that all client libraries in use are new enough to support SCRAM, set <code class=\"literal\">password_encryption = 'scram-sha-256'</code> in <code class=\"filename\">postgresql.conf</code>, make all users set new passwords, and change the authentication method specifications in <code class=\"filename\">pg_hba.conf</code> to <code class=\"literal\">scram-sha-256</code>.</p>\n</div>", "manual_path": "/docs/18/auth-password.html", "comparison_data": {"method": "md5", "documented_option_names": ["md5", "password", "scram-sha-256"]}, "comparison_hash": "652d575cd6534109f8b7130100f5e4349077ecfe11fb859b90029c257fc6f1a0"}, "comparison": {"left": "17", "right": "18", "status": "unchanged", "diff": ""}}