This works, when calling it directly:
augtool> print /files/etc/ssh/sshd_config/PermitRootLogin
/files/etc/ssh/sshd_config/PermitRootLogin[1] = "yes"
/files/etc/ssh/sshd_config/PermitRootLogin[2] = "yes"
/files/etc/ssh/sshd_config/PermitRootLogin[3] = "yes"
augtool> setm /files/etc/ssh/sshd_config/ PermitRootLogin no
augtool> print /files/etc/ssh/sshd_config/PermitRootLogin
/files/etc/ssh/sshd_config/PermitRootLogin[1] = "no"
/files/etc/ssh/sshd_config/PermitRootLogin[2] = "no"
/files/etc/ssh/sshd_config/PermitRootLogin[3] = "no"
But when I try to use this in a puppet manifest:
augeas { 'configure_sshd':
context => '/files/etc/ssh/sshd_config',
changes => [ 'set PasswordAuthentication no',
'setm PermitRootLogin no',
],
}
it errors with
err: /Stage[main]//Node[foobar]/Augeas[configure_sshd]: Could not evaluate: missing string argument 3 for setm
The problem was that I was using libaugeas-ruby package version 0.3.0 and setm need 0.4.0
I also tried last() option, because only the last found setting in the sshd config gets used.
It works in augtool directly:
and in puppet:
results in: