• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Enable SSH on Ubuntu 22.04

Written by Admin, Updated On January 10, 2023
ssh, terminal, ubuntu
How to Enable SSH on Ubuntu 22.04

SSH (Secure Shell) is an encrypted and secure protocol which provides secure data transmission between client and servers. OpenSSH is the server that implements SSH protocol to provide remote server shell access. You can connect to your system remotely, perform administrative tasks and access files. Also, you can transfer files securely via scp and sftp. In this tutorial we will show you how to enable SSH on an Ubuntu 22.04 system.

How to Enable SSH on Ubuntu 22.04#

If you have installed fresh Ubuntu, remote access via SSH is denied. You have to enable it for remote access. It is very easy with simple steps.

To install and enable SSH on your Ubuntu system, follow the below given steps as root or user with sudo privileges:

Step 1 – Update package index#

First of all, update the package index list.

sudo apt update

Step 2 – Install OpenSSH Server#

After updating the package list issue the below given command to install OpenSSH server:

sudo apt install openssh-server

It will prompt you to enter password, enter your password and hit Enter to continue to installation.

Step 3 – Verify Service#

SSH service will start automatically, once the installation is finished. Verify SSH Service by checking status:

sudo systemctl status ssh

You should get output as following:

● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   Active: active (running) since Sun 2022-11-30 12:27:57 UTC; 1 day 13h ago
  Process: 890 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 914 (sshd)
...

You can quit by pressing q to the command prompt.

Step 4 – Allow in Firewall#

If your system is secure with firewall then you should allow SSH port.

sudo ufw allow ssh

At this point, SSH is installed and you can connect to your Ubuntu system via SSH from any remote system. By default, Linux and macOS systems have SSH clients pre-installed. You can connect from a Windows machine by using an SSH client such as PuTTY.

Step 5 – Connect SSH Server#

To connect your Ubuntu machine over network you can use the ssh command followed by the username and the IP address as following:

ssh USERNAME@IP_ADDRESS

Here, you should replace with your real username and ip address of the remote host.

For example, username is tecnstuff and ip address is 103.168.3.125 then you should run command as below:

ssh tecnstuff@103.168.3.125

It will show a message when you connecting first time:

The authenticity of host '103.168.3.125 (103.168.3.125)' can't be established.
ECDSA key fingerprint is SHA256:cybd23mAJuNuBDunE++yowF7lgAs5a2bLFiO3qmLDPD.
Are you sure you want to continue connecting (yes/no)?

Type yes and you will be asked to enter password:

Warning: Permanently added '103.168.3.125' (ECDSA) to the list of known hosts.
tecnstuff@103.168.3.125's password:

On success, it will show default Ubuntu welcome message:

Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
...

This means you are now connected to remote system.

Disabling SSH on Ubuntu#

If you would like to disable the SSH server on your Ubuntu system, just stop the SSH service by typing:

sudo systemctl disable --now ssh

Again, to re-enable it, type:

sudo systemctl enable --now ssh

Conclusion#

This tutorial shown how to install and enable SSH on your Ubuntu 22.04 system. Now you can make remote session from your any client machine and do further admin tasks.

You can improve your remote machine security by changing the default SSH port, which will reduce the risk of automated attacks. To know more about SSH server read the official SSH manual page.

If you have any questions or feedback, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Elasticsearch on Ubuntu 22.04
Next Article   How to Install CouchDB on Debian 11

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook