ssh root@192.168.1.x
apt update apt dist-upgrade
apt install unattended-upgrades dpkg-reconfigure --priority-low unattended-upgrades
NOTE: Select Yes.
adduser peter
usermod -aG sudo peter
logout
Login using the peter user account.
NOTE:
mkdir ~/.ssh && chmod 700 ~/.ssh
logout
ssh-keygen -b 4096
NOTE: The 4096 is the Size. Bigger is better!
cd .ssh ls
NOTE: This should display some files:
#scp ~./ssh/id_rsa.pub peter@192.168.1.x:~/.ssh/authorized_keys ssh-copy-id peter@192.168.1.x
NOTE: This will create an authorized_keys file in .ssh on the server.
Try to log into server.
NOTE: This should allow access without asking for a password.
Passwords still work.
To stop this:
ssh peter@192.168.1.x sudo vi /etc/ssh/sshd_config
NOTE: Make the following changes:
sudo systemctl restart sshd
Do not log out.
Open a new terminal window
ssh peter@192.168.1.x
NOTE: This should not work.
ssh peter@192.168.1.x -p 717
NOTE: This should work, as port was changed in config file.
sudo ss -tulpn
sudo apt install ufw sudo ufw status
sudo ufw allow 717 sudo ufw status
sudo ufw enable
NOTE: Press y.
sudo ufw status
Open a new terminal window
ssh peter@192.168.1.x -p 717
NOTE: This should work.
sudo ufw allow 80/tcp
sudo vi /etc/ufw/before.rules
->ok icmp codes for input
ufw-before-input -p icmp --icmp-type echo-request -j DROP
sudo ufw reload
sudo reboot
NOTE: Test pinging the machine.