From 92a6e9137529eb56e2fb9dd0875fbe82b2cd92ef Mon Sep 17 00:00:00 2001 From: djorgensen Date: Thu, 15 Aug 2024 16:44:06 -0600 Subject: [PATCH] ansible commands --- ansiblecommands.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 ansiblecommands.sh diff --git a/ansiblecommands.sh b/ansiblecommands.sh new file mode 100644 index 0000000..521e07a --- /dev/null +++ b/ansiblecommands.sh @@ -0,0 +1,8 @@ +useradd -m -G sudo ansible +su -c "mkdir -p ~/.ssh/" ansible +echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBX2aDGxUt1lLO4IQf2O0RaAUv+FjX6Dlt68KJTd22pk ansible@ansible" >> /home/ansible/.ssh/authorized_keys +chown ansible:ansible /home/ansible/.ssh/authorized_keys +chmod 664 /home/ansible/.ssh/authorized_keys +echo -e "Include /etc/ssh/sshd_config.d/*.conf\nPort 22\nLoginGraceTime 2m\nPermitRootLogin no\nStrictModes yes\nMaxAuthTries 6\nMaxSessions 10\nPasswordAuthentication no\nPubkeyAuthentication yes\nAllowUsers djorgensen ansible\nAuthorizedKeysFile .ssh/authorized_keys\nChallengeResponseAuthentication no\nUsePAM yes\nX11Forwarding yes\nPrintMotd no\nAcceptEnv LANG LC_*\nSubsystem sftp /usr/lib/openssh/sftp-server\n" | tee /etc/ssh/sshd_config +systemctl restart sshd +systemctl status sshd \ No newline at end of file