Managing a user password for linux in puppet

后端 未结 8 975
心在旅途
心在旅途 2020-12-07 16:00

I need to create a test user with a password using puppet.

I\'ve read that puppet cannot manage user passwords in a generic cross-platform way, which is a pity. I am

8条回答
  •  广开言路
    2020-12-07 16:11

    You can use the generate function to let Puppet create the hash for you:

    $password = 'hello'
    
    user { 'test_user':
        ensure   => 'present',
        password => generate('/bin/sh', '-c', "mkpasswd -m sha-512 ${password} | tr -d '\n'"),
    }
    

提交回复
热议问题