How to setup SSH server for Ubuntu MATE Raspberry Pi 2 and Raspberry Pi 3

How do I configure a new Ubuntu Raspberry Pi installation to accept ssh connections?

Follow these commands and you are ready:

sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow 22
That's the very minimum. It allows unlimited failed password attempts on a known port. Direct root-login is disabled (you can still su and sudo once logged in).
You need to harden it from the standard setup. I suggest:
  • Key-based logins. Disable password logins.
  • Move it off port 22. Use something crazy-high, in the 20000-60000 range.
  • Use fail2ban to ban people who do find it and try to brute it.
Move the SSH server to another port

Open /etc/ssh/sshd_config as root user and change PORT 

sudo ufw allow PORT
sudo /etc/init.d/ssh restart
use raspberry user to remotely login

If SSH service not start automatically on boot, try just simply setting

sudo systemctl enable ssh


Post a Comment