How to install OpenSSH server on Ubuntu Linux?

Harish Kumar · · 2193 Views

sshd (OpenSSH Daemon) is the daemon program for SSH client. SSH replaces unreliable rlogin and rsh, and give securely encrypted communications between two untrusted hosts over the Internet. Ubuntu Desktop and minimal Ubuntu server don't come sshd installed. Nonetheless, you can undoubtedly install SSH server in Ubuntu using the following steps.

1. Install OpenSSH server

To install openssh-server package, run:

$ sudo apt install openssh-server

2. Verify that ssh service running

Run the following systemctl command:

$ sudo systemctl status ssh

If not running then run following systemctl command:

$ sudo systemctl enable ssh
$ sudo systemctl start ssh

3. Test it

Now you can login from your desktop computer (Linux, macOS, Windows using putty client) using the ssh command:

$ ssh user@server-ip

You can copy and install the public key using ssh-copy-id command for password less login:

$ ssh-copy-id user@server-ip

Ssh config file

Using ssh config, you can create shortcuts for ssh login. For example, create a file named ~/.ssh/config as follows:

$ vi ~/.ssh/config

Add the following snippet to create login shortcut for your server: 

Host web01
        HostName server-id
        Port 22
        IdentityFile  ~/.ssh/private_key
        User server-username

To login run following command on terminal:

ssh web01

Please login or create new account to add your comment.

You may also like:

Understanding Linux File Permissions and Ownership

Linux file permissions are a critical cornerstone in the architecture of Linux systems, serving as a fundamental aspect of their security model. They meticulously define who can (...)
Harish Kumar

How To Install NVM (Node Version Manager) on Ubuntu System?

This tutorial will assist you with installing NVM on the Ubuntu machine. Additionally, allow you to install different node versions and other useful examples.
Harish Kumar

Install Laravel Valet Linux+ development environment on Ubuntu System

The official Laravel Valet development environment is great if you are an Apple user. But there is no official Valet for Linux or Window system.
Harish Kumar

Install and Setup Oh-My-Zsh on Ubuntu System

In this post, I will show you how to install ZSH (Z-Shell). Then, we set up the oh-my-zsh framework for managing ZSH. We will likewise show you how to change the ZSH theme and (...)
Harish Kumar

10 Things to Do After Installing Ubuntu Operating System

In this article, I will show you 40 things you can do after installing Ubuntu on your system. This isn't restricted to a specific version of Ubuntu; you can follow these on any (...)
Harish Kumar

Ubuntu Installation step by step guide with disk partitioning

Ubuntu is the most loved OS for many desktop users, particularly for developers. Canonical releases new Ubuntu versions every six months with free support for nine months and every (...)
Harish Kumar