Update Section_04/main.sh

This commit is contained in:
Kishan Takoordyal 2023-05-19 06:52:03 +00:00
commit becdbc9586

28
Section_04/main.sh Normal file
View File

@ -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