Tue Oct 21, 2014 3:03 pm
# Allow users to login to ssh with passwords if desired.
# Allow root login only with auth keys.
# or do nothing.
if [[ $ssh_pass = "yes" ]] ; then
sed -i~ 's/PasswordAuthentication no/PasswordAuthentication yes/' /target(*/*)etc/ssh/sshd_config
sed -i 's/PermitRootLogin yes/PermitRootLogin without-password/' /target(*/*)etc/ssh/sshd_config
elif [[ $ssh_pass = "no" ]] ; then
sed -i~ 's/ PasswordAuthentication yes/PasswordAuthentication no/' /target(*/*)etc/ssh/sshd_config
sed -i 's/PermitRootLogin yes/PermitRootLogin without-password/' /target(*/*)etc/ssh/sshd_config
elif [[ -n "$ssh_pass" ]] ; then
echo "WARNING: ssh_pass value not recognized. No changes were made to (*/*)etc/ssh/sshd_config"
fi
# SSH Settings
# The default setup in debian has password authentication turned off,
# and root can only log in with authentication keys.
# If ssh_pass="yes", then PasswordAuthentication will be set to "yes"
# If ssh_pass="no", then PasswordAuthentication will be set to "no"
# In either of the above cases, if PermitRootLogin was set to "yes",
# it will be changed to "without-password" (meaning with auth keys only)
# If ssh_pass is null or set to anything other than "yes" or "no", then
# (*/*)etc/ssh/sshd_config will not be altered.
ssh_pass=""
Wed Dec 24, 2014 3:32 pm
sed -i -e 's|#\(PasswordAuthentication\) yes|\1 no|' (/)etc/ssh/sshd_config
sed -i -e 's|#\(PasswordAuthentication\) no|\1 yes|' (/)etc/ssh/sshd_confi
#PasswordAuthentication yes
sed -i -e 's|.*PasswordAuthentication.*no|#PasswordAuthentication yes|' (/)etc/ssh/sshd_config