• Install SSH Server
 
sudo apt-get update 
sudo apt-get upgrade 
sudo apt-get install openssh-server
  • Configure SSH server on port 1234
 
sudo sed -ri 's/^Port 22/Port 1234/g' /etc/ssh/sshd_config
  • Set maximum login attempts to 3 1

Edit the SSH server config file /etc/ssh/sshd_config as below:

 
# Maximum login tries
MaxAuthTries 3
# Allowed users
AllowUsers user1 user2
  • Restart ssh service
 
sudo systemctl restart ssh
  1. http://linux-sys-adm.com/ubuntu-16.04-lts-how-to-install-and-configure-ssh/