mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #63522 from OrangeDog/patch-9
Docs: use Salt function to hash passwords
This commit is contained in:
commit
2ce36b4a9c
2 changed files with 2 additions and 26 deletions
|
@ -220,22 +220,7 @@ def del_password(name):
|
|||
def set_password(name, password):
|
||||
"""
|
||||
Set the password for a named user. The password must be a properly defined
|
||||
hash. The password hash can be generated with this command:
|
||||
|
||||
``python -c "import crypt; print crypt.crypt('password', ciphersalt)"``
|
||||
|
||||
.. note::
|
||||
When constructing the ``ciphersalt`` string, you must escape any dollar
|
||||
signs, to avoid them being interpolated by the shell.
|
||||
|
||||
``'password'`` is, of course, the password for which you want to generate
|
||||
a hash.
|
||||
|
||||
``ciphersalt`` is a combination of a cipher identifier, an optional number
|
||||
of rounds, and the cryptographic salt. The arrangement and format of these
|
||||
fields depends on the cipher and which flavor of BSD you are using. For
|
||||
more information on this, see the manpage for ``crpyt(3)``. On NetBSD,
|
||||
additional information is available in ``passwd.conf(5)``.
|
||||
hash. A password hash can be generated with :py:func:`gen_password`.
|
||||
|
||||
It is important to make sure that a supported cipher is used.
|
||||
|
||||
|
|
|
@ -339,16 +339,7 @@ def unlock_password(name, root=None):
|
|||
def set_password(name, password, use_usermod=False, root=None):
|
||||
"""
|
||||
Set the password for a named user. The password must be a properly defined
|
||||
hash. The password hash can be generated with this command:
|
||||
|
||||
``python -c "import crypt; print crypt.crypt('password',
|
||||
'\\$6\\$SALTsalt')"``
|
||||
|
||||
``SALTsalt`` is the 8-character crpytographic salt. Valid characters in the
|
||||
salt are ``.``, ``/``, and any alphanumeric character.
|
||||
|
||||
Keep in mind that the $6 represents a sha512 hash, if your OS is using a
|
||||
different hashing algorithm this needs to be changed accordingly
|
||||
hash. A password hash can be generated with :py:func:`gen_password`.
|
||||
|
||||
name
|
||||
User to set the password
|
||||
|
|
Loading…
Add table
Reference in a new issue