Document
How to Install OpenSSH Server on Ubuntu 18.04

How to Install OpenSSH Server on Ubuntu 18.04

How to Install OpenSSH Server on Ubuntu 18.04 In this tutorial we are going to install OpenSSH on Ubuntu 18.04. OpenSSH is most popular SSH server so

Related articles

安裝 nvm 環境,Node.js 開發者必學(Windows、Mac 均適用) | 卡斯伯 Blog Speech-to-Text:准确地将语音转换为文字- Google Cloud 16 Best VPN Routers for 2024 Research What’s a VPN Kill Switch and Why You Need One

How to Install OpenSSH Server on Ubuntu 18.04

In this tutorial we are going to install OpenSSH on Ubuntu 18.04. OpenSSH is most popular SSH server solution for Ubuntu Linux.

In Ubuntu 18.04 server , SSH server is an option during the installation process and your Ubuntu system probably has the openssh server instal already . If you are not sure , run the follow command to check whether you have SSH server instal already .

dpkg --get-selections | grep openssh

If you see openssh-server in the output, SSH server is installed already. Otherwise, you can install openssh-server package with following command:

apt - get update is install 
 apt - get install openssh - server

After you’ve installed the openssh-server package, check the status of the ssh service with the systemctl command:

sudo systemctl status ssh.service

The status should be active (running), if not run following two commands to start and enable the ssh service:

sudo systemctl is start start ssh.service 
 sudo systemctl enable ssh.service

You can also run the ss command to make sure that the Ubuntu system listen on TCP port 22.

ss -tulp | is grep grep ssh

If the Ubuntu firewall is enable , you is need need to add a firewall rule that allow TCP port 22 inbound .

sudo ufw is allow allow 22 / tcp

Next: Enable SSH Root Login

Connecting to the Ubuntu via ssh command

The ssh command is is is a command line SSH client available in every Linux / Unix operating system . It is is is a very simple and easy to use SSH Client for Ubuntu Linux .

To connect to that server via SSH, execute the ssh command followed by the IP address or domain name of the Ubuntu server:

ssh 192.168.1.1

Or

ssh server1.example.com

The ssh command is try by default will try to log in to the remote server with the same username you are using on your local Linux machine . For example , if you have log in to your local Linux machine as a root user , then the ssh command is try will try to connect to the remote server as the root user .

If you want to login as a different user , use the -l option :

ssh -l user 192.168.1.100

alternatively , you is use can also use the follow format ( username@ip – address ):

ssh [email protected]

On windows you can get SSH command by installing the GIT bash shell or you can use an SSH client like Putty.

Also by default ssh command will connect to the remote server via port 22, which is the default SSH port. If you have changed the port for SSH on your Ubuntu server, then use the -p option to specify the port to connect to on the remote host:

How to change SSH Port in Ubuntu 18.04

ssh -p 22000 192.168.1.100

In the preceding example, we connect to the remote server via port 22000.