Update Section_04/main.sh
This commit is contained in:
commit
becdbc9586
28
Section_04/main.sh
Normal file
28
Section_04/main.sh
Normal 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
|
Loading…
x
Reference in New Issue
Block a user