From becdbc9586c23e4c7c51628a51e8336c14a41e7a Mon Sep 17 00:00:00 2001 From: Kishan Takoordyal Date: Fri, 19 May 2023 06:52:03 +0000 Subject: [PATCH] Update Section_04/main.sh --- Section_04/main.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Section_04/main.sh diff --git a/Section_04/main.sh b/Section_04/main.sh new file mode 100644 index 0000000..8b21157 --- /dev/null +++ b/Section_04/main.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +IP_ADDRESS="" +ssh "root@${IP_ADDRESS}" + +apt update +apt install nano -y + +# Create new non-root user +USERNAME="" +useradd -m -s /bin/bash -G sudo ${USERNAME} +passwd ${USERNAME} + +su ${USERNAME} +mkdir ~/.ssh +touch ~/.ssh/authorized_keys +# LOCAL: cat .ssh/id_rsa.pub +nano ~/.ssh/authorized_keys +ssh-keygen -t rsa + +# Change default SSH configs +sudo nano /etc/ssh/sshd_config + +# Port 50683 +# PermitRootLogin no +# PasswordAuthentication no + +sudo systemctl restart sshd