Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created March 1, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domcleal/1952407 to your computer and use it in GitHub Desktop.
Save domcleal/1952407 to your computer and use it in GitHub Desktop.
#!/bin/sh
[ -d etc/ssh ] || mkdir -p etc/ssh
echo "PermitRootLogin no" > etc/ssh/sshd_config
cat <<EOF | augtool -er .
set /augeas/save newfile
get /augeas/version
print /augeas/files/etc/ssh/sshd_config
set /files/etc/ssh/sshd_config/PermitRootLogin yes
save
print /augeas/files/etc/ssh/sshd_config
print /files/etc/ssh/sshd_config
load
print /augeas/files/etc/ssh/sshd_config
print /files/etc/ssh/sshd_config
EOF
echo expected output would be no on the last time after load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment