How to enable SSH on Ubuntu 18.04
Table of Contents
Enable SSH on Ubuntu 18.04
SSH stands for Secure Shell Service which allows secure remote login and other network operations. In this tutorial, you will learn how to enable SSH on Ubuntu Desktop. By using ssh you can connect to your computer remotely, access files and perform administrative tasks.
Before you start to enable SSH on Ubuntu 18.04. You must have the non-root user account on your server with sudo privileges.
Install SSH On Ubuntu
Here you will install SSH from Ubuntu repository. It’s very much easier to install SSH on Ubuntu.
Update apt package manager index by typing following command
sudo apt update
You will need to install OpenSSH-Server (OpenBSD Secure Shell) which is available in Ubuntu universal repository. Type following command to install OpenSSH Server
sudo apt install openssh-server
Now you will get prompt for the password, just enter the password.
When you install ssh it will be automatically started. To confirm the installation type following command in terminal, it will print the status of ssh service.
sudo systemctl status ssh
Output should be
Output Active: active (running) :
Now press q to go back to the terminal.
Editing SSH Configuration File
You can edit the ssh configuration according to your requirements. To edit SSH configuration enter the following command.
sudo nano /etc/ssh/sshd_config
If you have not installed nano then you can also use Gedit Text Editor which comes by default in Ubuntu.
sudo gedit /etc/ssh/sshd_config
After editing file save and close Gedit.
Using SSH With LAN
After enabling the ssh, If you want to connect your Ubuntu Desktop in LAN then you should enter the following command in terminal
Replace username with your Ubuntu Desktop username and replace the IP address with the IP Address of the machine you want to connect.
To get the IP address of machine enter following command
Once you get IP address then you can connect by typing
When you are connecting the first time it will prompt you an alert. Enter “yes” to continue.
Now you should enter the password of the machine which you want to connect and press Enter.
Using SSH With Internet
First, you will need to know the public IP address of the machine you want to connect. You can check it by entering the following command.
now enter the following command to connect to your machine
ssh [email protected]_ip_address
NOTE: As you are exposing your machine to the internet you will need to configure the router to accept SSH traffic.
Basic Operations In SSH
To start SSH service enter following command
sudo systemctl start ssh
To stop ssh service enter following command
sudo systemctl stop ssh
To enable SSH on Ubuntu type the following command:
sudo systemctl enable ssh
Disable SSH service by typing
sudo systemctl enable ssh
Here you have learned to enable SSH on Ubuntu 18.04 Desktop successfully. If you have any queries don’t forget to comment below.
How to Install Apache on Debian 10
How to Change Hostname on Debian 9
How to Add Swap Space on Linux Mint 19
How to Install PostgreSQL on CentOS 7
How to Install FFmpeg on Ubuntu 18.04
How to Change Hostname on CentOS 7
How to Install IntelliJ IDEA IDE on Fedora 29
How to Install FFmpeg on Debian 9
How to List Installed Packages on Linux Mint 18
How to Install Git on CentOS 7
How to Install IntelliJ IDEA IDE on Debian 9
How to Install MySQL on Debian 9