How to install OpenSSH server on Ubuntu Linux?

Harish Kumar · · 2747 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
0

Please login or create new account to add your comment.

0 comments
You may also like:

How to Grant Passwordless `Sudo` for Specific Commands on Linux 🚀

Managing a self-hosted server or Virtual Private Server (VPS) often involves repetitive administrative tasks. Continuously entering your sudo password can quickly become tedious. (...)
Harish Kumar

Essential Linux Command Line Cheatsheets for Beginners and Advanced Users

The Linux command line is a powerful tool for managing your system efficiently. Whether you're a beginner exploring the terminal or an advanced user handling complex tasks, cheatsheets (...)
Harish Kumar

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