29 lines
473 B
Bash
29 lines
473 B
Bash
#!/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
|