How To Install OpenSSH Ubuntu 16.04

Step 1: Install OpenSSH

1.1 Install OpenSSH server

sudo apt-get install openssh-server -y

1.2 Edit SSH config file

sudo nano /etc/ssh/sshd_config

1.3 Change SSH default port and remove the ‘#’  from the statement

# What ports, IPs and protocols we listen for
# Port 22

Change the ssh port to 999

# What ports, IPs and protocols we listen for
Port 999
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0

Disable root login for enhanced security

Change the ‘PermitRootLogin prohibit-password’ statement to ‘no’


# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

Exit and Save

1.4 Restart  ssh service

sudo service ssh restart

1.5 Verify ssh service

sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-11-02 23:53:56 CET; 7s ago
  Process: 2153 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 2157 (sshd)
    Tasks: 1
   Memory: 716.0K
      CPU: 6ms
   CGroup: /system.slice/ssh.service
           └─2157 /usr/sbin/sshd -D

Nov 02 23:53:56 srv6 systemd[1]: Stopped OpenBSD Secure Shell server.
Nov 02 23:53:56 srv6 systemd[1]: Starting OpenBSD Secure Shell server...
Nov 02 23:53:56 srv6 sshd[2157]: Server listening on 0.0.0.0 port 999.
Nov 02 23:53:56 srv6 sshd[2157]: Server listening on :: port 999.
Nov 02 23:53:56 srv6 systemd[1]: Started OpenBSD Secure Shell server.

Donate