allow makeitso to be re-run

This commit is contained in:
Emil Lerch 2021-07-16 09:59:50 -07:00
parent ae51e774ae
commit 9e8d93d4ea
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -5,9 +5,12 @@ if [ $# -ne 1 ]; then
exit 1 exit 1
fi fi
if [ ! -d /home/authorizedkeysuser ]; then
#sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser || #sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser ||
sudo useradd -c 'User for AuthorizedKeysCommand' -d /home/authorizedkeysuser -m -s/usr/sbin/nologin authorizedkeysuser sudo useradd -c 'User for AuthorizedKeysCommand' -d /home/authorizedkeysuser -m -s/usr/sbin/nologin authorizedkeysuser
fi
grep -q AuthorizedKeysCommand /etc/ssh/sshd_config || \
sudo sh -c "echo 'Match User $1 sudo sh -c "echo 'Match User $1
AuthorizedKeysCommand /etc/ssh/get_authorized_keys AuthorizedKeysCommand /etc/ssh/get_authorized_keys
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config" AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"