How to Enable SSH on Ubuntu 20.10 Groovy Gorilla

In this article, we’ll see how to enable SSH on Ubuntu 20.10 Groovy Gorilla system. The use of SSH allows you to connect the remote system/server. By default, a fresh installed Ubuntu system doesn’t allow ssh access you need to enable it.

Prerequisite 

  • Access to an Ubuntu machine with root or sudo privileges
  • Text editor

Steps to enable SSH on Ubuntu 20

Step 1: Log in to Ubuntu via GUI console 

Once you login Ctrl+Alt+T or click on show application and type “terminal

$ sudo apt update

$ sudo apt install openssh-server

Press “y” to continue the installation

How to Enable SSH on Ubuntu 20

Sample output:

ubuntu@zabbix:~$ sudo apt install openssh-server
[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following package was automatically installed and is no longer required:
virtualbox-guest-utils
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
ncurses-term openssh-sftp-server ssh-import-id
Suggested packages:
molly-guard monkeysphere ssh-askpass
The following NEW packages will be installed:
ncurses-term openssh-server openssh-sftp-server ssh-import-id
0 upgraded, 4 newly installed, 0 to remove and 54 not upgraded.
Need to get 687 kB of archives.
After this operation, 5,971 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu groovy/main amd64 ncurses-term all 6.2-1 [247 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu groovy/main amd64 openssh-sftp-server amd64 1:8.3p1-1 [51.4 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu groovy/main amd64 openssh-server amd64 1:8.3p1-1 [378 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu groovy/main amd64 ssh-import-id all 5.10-0ubuntu1 [10.0 kB]
Fetched 687 kB in 6s (123 kB/s) 
Preconfiguring packages ...
Selecting previously unselected package ncurses-term.
(Reading database ... 147155 files and directories currently installed.)
Preparing to unpack .../ncurses-term_6.2-1_all.deb ...
Unpacking ncurses-term (6.2-1) ...
Selecting previously unselected package openssh-sftp-server.
Preparing to unpack .../openssh-sftp-server_1%3a8.3p1-1_amd64.deb ...
Unpacking openssh-sftp-server (1:8.3p1-1) ...
Selecting previously unselected package openssh-server.
Preparing to unpack .../openssh-server_1%3a8.3p1-1_amd64.deb ...
Unpacking openssh-server (1:8.3p1-1) ...
Selecting previously unselected package ssh-import-id.
Preparing to unpack .../ssh-import-id_5.10-0ubuntu1_all.deb ...
Unpacking ssh-import-id (5.10-0ubuntu1) ...
Setting up openssh-sftp-server (1:8.3p1-1) ...
Setting up openssh-server (1:8.3p1-1) ...

Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
3072 SHA256:af4HpDFWT0iwbBtQPXe6EuV+2MsWb/aqrVakvi86Aa8 root@server (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:axc/DR6X0y8fKvQXrhGe0fnJJJGoEc6CRchHnVohQe8 root@server (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:4ASwth1eiP6PhSgVv++mqviHMjp5+kGnhtooR1cQhjk root@server (ED25519)
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
rescue-ssh.target is a disabled or a static unit, not starting it.
Setting up ssh-import-id (5.10-0ubuntu1) ...
Attempting to convert /etc/ssh/ssh_import_id
Setting up ncurses-term (6.2-1) ...
Processing triggers for systemd (246.6-1ubuntu1) ...
Processing triggers for man-db (2.9.3-2) ...
Processing triggers for ufw (0.36-7) ...
ubuntu@zabbix:~$

After installation SSH service automatically gets started. 

Step 2: Verify SSH service status

sudo systemctl status ssh

How to Enable SSH on Ubuntu 20

Sample output:

ubuntu@zabbix:~$ 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 Mon 2021-02-01 09:35:48 EST; 1min 44s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 3702 (sshd)
Tasks: 1 (limit: 4649)
Memory: 1.2M
CGroup: /system.slice/ssh.service
└─3702 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Feb 01 09:35:48 server systemd[1]: Starting OpenBSD Secure Shell server...
Feb 01 09:35:48 server sshd[3702]: Server listening on 0.0.0.0 port 22.
Feb 01 09:35:48 server sshd[3702]: Server listening on :: port 22.
Feb 01 09:35:48 server systemd[1]: Started OpenBSD Secure Shell server.
ubuntu@zabbix:~$

Step 3: Configure firewall 

Optional – If you are using firewall then follow below steps to configure ssh.

sudo ufw allow ssh

Sample output:

ubuntu@zabbix:~$ sudo ufw allow ssh
Rules updated
Rules updated (v6)
ubuntu@zabbix:~$

From any remote Linux machine, you can connect to Ubuntu server via ssh and from windows, you can connect it by using a putty tool.

End of article – how to enable SSH on Ubuntu 20.10 Groovy Gorilla.

See also:

Linux Blogs

AWS Cloud Blogs

Database Blogs

DevOps Blogs

Interview Questions & Answers

Docker Blogs

Google Cloud Blogs