Configuring SSH securely (the correct way)

First step, install OpenSSH. On Ubuntu you can use "sudo apt install openssh-server"

Edit file “/etc/hosts.allow” and allow only specific IPs or network to access over ssh.

# Example (network
sshd: 192.168.0.

Block all another IPs editing “/etc/hosts.deny” with:

sshd: ALL

Edit file “/etc/ssh/sshd_config” and include this role:  “PermitRootLogin no”

Install UFW firewall, allow SSH connections and enable firewall:

sudo apt install ufw
sudo ufw allow ssh
sudo ufw enable

Leave a Reply

Your email address will not be published.