Skip to content

Instantly share code, notes, and snippets.

@xorpaul
Last active December 31, 2015 00:39
Show Gist options
  • Save xorpaul/7908389 to your computer and use it in GitHub Desktop.
Save xorpaul/7908389 to your computer and use it in GitHub Desktop.
Augeas /etc/ssh/sshd_config AllowUser

Is there a better way to do this?

augeas { 'add_allow_users':
  context  => '/files/etc/ssh/sshd_config',
  changes  => [ 
    'set AllowUsers/1 alice',
    'set AllowUsers/2 bob',
    'set AllowUsers/3 charlie',
    ...
  ],
  notify   => Service['ssh'],
} 

https://www.redhat.com/archives/augeas-devel/2013-March/msg00032.html

I wanted to use something like this:

$usergroup_a = 'alice bob'
$usergroup_b = 'charlie'
@xorpaul
Copy link
Author

xorpaul commented Dec 11, 2013

$group_a = 'alice bob'
$group_b = 'charlie dude'
sshd_config { 'AllowUsers':
  ensure => present,
  value  => flatten([ split($group_a, ' '), split($group_b, ' ')]),
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment