Created
April 11, 2012 18:01
-
-
Save jeffmccune/2360984 to your computer and use it in GitHub Desktop.
Manage the Root User Password on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# = Class: site::root_user | |
# | |
# This is a simple class to manage the root user password. | |
# The shadow hash of an existing password can be easily obtained | |
# by running `puppet resource user root` on a Linux system | |
# that has the desired root password already set. | |
# Puppet will then manage this password everywhere. | |
# | |
# First, I set the password to "puppet" on one Linux node and then get back the | |
# shadow hash. | |
# | |
# root@pe-centos6:~# passwd root | |
# Changing password for user root. | |
# New password: | |
# BAD PASSWORD: it does not contain enough DIFFERENT characters | |
# BAD PASSWORD: is too simple | |
# Retype new password: | |
# passwd: all authentication tokens updated successfully. | |
# root@pe-centos6:~# puppet resource user root | |
# user { 'root': | |
# ensure => 'present', | |
# comment => 'root', | |
# gid => '0', | |
# groups => ['root', 'bin', 'daemon', 'sys', 'adm', 'disk', 'wheel'], | |
# home => '/root', | |
# password => '$6$7pe0INu/$Uxsn.lb/mJjd9394DIJx5JS9a1NVhrpWDpXRtPGS78/BfyShhOf1G0ft7mRHspXDZo6.ezyqpqIXHQ8Tl8ZJt0', | |
# password_max_age => '99999', | |
# password_min_age => '0', | |
# shell => '/bin/bash', | |
# uid => '0', | |
# } | |
# | |
# = Sample Usage | |
# | |
# include site::root_user | |
# | |
# (MARKUP: http://links.puppetlabs.com/puppet_manifest_documentation) | |
class site::root_user { | |
# This will enforce the root password of "puppet" | |
user { root: | |
ensure => present, | |
password => '$6$7pe0INu/$Uxsn.lb/mJjd9394DIJx5JS9a1NVhrpWDpXRtPGS78/BfyShhOf1G0ft7mRHspXDZo6.ezyqpqIXHQ8Tl8ZJt0', | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment