Secure Shell Service known as SSH which is used for secure connection between a client computer and a server. Using SSH you can connect to your system remotely, perform administrative tasks and access files.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related SSH queries on Ubuntu.
In this context, we shall look into how to enable SSH on Ubuntu to communicate securely with server.
$ sudo apt update
ii. Now issue the below command to install SSH:$ sudo apt install openssh-server
It will prompt you to enter password so just enter it and hit Enter key to continue with installation.$ sudo systemctl status ssh
It should show status as active as given below:● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Mon 2019-04-25 05:08:17 UTC; 45s ago
Main PID: 1001 (sshd)
Tasks: 1 (limit: 1152)
CGroup: /system.slice/ssh.service
└─1001 /usr/sbin/sshd -D
iv. Press q key to go back to terminal.
How to connect to SSH Over LAN ?
i. You can connect your Ubuntu system over LAN using following command:
$ ssh username@ip_address
ii. Change the username with your real Ubuntu user name and ip_address with your Ubuntu system ip address which you want to connect.$ ifconfig
iv. Now go back to remote machine from where you were trying to connect and run below command:$ ssh linuxapt@192.168.43.125
When you will connect it for first time, it will prompt you message like below:The authenticity of host '192.168.43.125 (192.168.43.125)' can't be established.
ECDSA key fingerprint is SHA256:Rcbtm61VXuErBl7nE2+yowF7lgA2bLSiO/33/7qmRJP.
Are you sure you want to continue connecting (yes/no)?
Type yes and hit Enter key to continue. Next you will be prompted to enter password. Once you provide correct password then you will be logged in and show greeting message as below:
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-1035-aws x86_64)
Documentation: https://help.ubuntu.com
Management: https://landscape.canonical.com
Support: https://ubuntu.com/advantage
...
...
How to connect to SSH Over Internet ?$ ssh username@public_ip_address
If you are exposing your machine to the internet you will need to configure the router to accept SSH traffic. Mostly, to configure your router to accept SSH traffic on a non-standard port and forward it to port 22 on the machine running the SSH service.
You can also secure your connection by setting up a SSH key-based authentication to your Ubuntu machine.
How to Manage SSH Service ?
For any reason you want to stop SSH service then you can do it by execute below command:
$ sudo systemctl stop ssh
To start it you can issue below command and can start it:$ sudo systemctl start ssh
You can enable SSH service by running following command:$ sudo systemctl enable ssh
Again, you can disable the SSH service by issuing below command:$ sudo systemctl disable ssh
This article covers how to install and Enable SSH service on Ubuntu 18.04 system. You can now login remotely to your server using any SSH client from Linux or Windows system. To increase security of SSH connection by Changing default SSH port to custom one on you system. Get more details about SSH server from official SSH site.
When establishing a remote connection between a client and a server, a primary concern is ensuring security. For Linux users, the best practice of accessing and managing your server remotely is through the cryptographic protocol known as Secure Shell (SSH).
How to Enable SSH on Ubuntu ?
1. To install SSH, first update the package repository cache with:
$ sudo apt-get update
2. Now install the OpenSSH software package by entering:
$ sudo apt-get install openssh-server
If prompted, type in your password and press y (yes) to permit the installation.
3. To verify the installation was successful and SSH is running use the command:
$ sudo service ssh status
The confirmation message that you are looking for is: Active: active (running).