Salt: How to change password of a minion through salt master

Created on 7 Jan 2015  路  2Comments  路  Source: saltstack/salt

Hi,

Please suggest me the way how to change password of a minion through salt master.

Thanks,
Abhishek Jain

Question fixed-pending-your-verification

Most helpful comment

If by "change the password of a minion" you mean change the password of a user on the minion system, you should use the user.present state. Note that you need a password hash, not a cleartext password, which you can generate using shadow.gen_password:

# salt '*' shadow.gen_password mypassword
basepi-debian:
    $6$EsYe5SZH$X7eH65bYsr8DR2mJfHACmZs5nspN4OPT/kerYlYyKRDZwYlMWvtnnhTPiIsc8DDQxPSf1kvH.RLL6usqVOYFn1

You can use this password hash in the user.present state like so:

basepi_user:
  user.present:
    - name: basepi
    - password: $6$EsYe5SZH$X7eH65bYsr8DR2mJfHACmZs5nspN4OPT/kerYlYyKRDZwYlMWvtnnhTPiIsc8DDQxPSf1kvH.RLL6usqVOYFn1

Note that you should probably put that password hash into a Pillar value and fetch it from there to be more secure.

All 2 comments

If by "change the password of a minion" you mean change the password of a user on the minion system, you should use the user.present state. Note that you need a password hash, not a cleartext password, which you can generate using shadow.gen_password:

# salt '*' shadow.gen_password mypassword
basepi-debian:
    $6$EsYe5SZH$X7eH65bYsr8DR2mJfHACmZs5nspN4OPT/kerYlYyKRDZwYlMWvtnnhTPiIsc8DDQxPSf1kvH.RLL6usqVOYFn1

You can use this password hash in the user.present state like so:

basepi_user:
  user.present:
    - name: basepi
    - password: $6$EsYe5SZH$X7eH65bYsr8DR2mJfHACmZs5nspN4OPT/kerYlYyKRDZwYlMWvtnnhTPiIsc8DDQxPSf1kvH.RLL6usqVOYFn1

Note that you should probably put that password hash into a Pillar value and fetch it from there to be more secure.

Closing since question has been answered.

Was this page helpful?
0 / 5 - 0 ratings