نصب OpenSSH در سرور Ubuntu


Install OpenSSH on Ubuntu Server quick howto

 

As part of the main preparation process for a Linux based vApp this article is following up with the steps on how to install OpenSSH Server on a Ubuntu Server virtual machine. Secure Shell (SSH) is a protocol which allows to connect to a Host over an unsecure network. The typical tasks include remote login, and commands executions. This is a perfect replacement for other legacy network protocols that could send passwords and other sensitive information in clear text.

The purpose of this quick article is to show the steps to install OpenSSH Server on a Ubuntu Server virtual machine. This will make the management of the server a lot easier without requiring to open any remote console or even use a remote desktop connection application. A simple SSH client like putty for example running on a Windows machine will be able to connect and manage the Ubuntu Server over a secure network connection with SSH enabled encryption.

OpenSSH runs by default on Network Port 22. Same applies to both Unix and Windows system types. If required or even for extra security it is possible to change this Port to a custom value.

OpenSSH Server can be installed as part of the main installation of the Ubuntu Server Operating System itself. Should this have been omitted or not included in any deployment scripts for unattended installations the next steps show the process to install OpenSSH Server.

 

How to install OpenSSH Server on Ubuntu

From the VMware vCenter Client > Virtual Machine Name > the option to run the VMware Remote console. Once the session is started and straight after the login to the Ubuntu Server the command line to install OpenSSH is pretty simple. For a non root account:

“sudo apt install -y openssh-server”

will search for the package definition into the local cache of the package manager and start the install process. Ideally a “sudo apt update” first comes handy to update the local cache with latest packages definitions.

domalab.com Install OpenSSH Ubuntu Server

In a matter of few seconds the step to install OpenSSH Server is complete. As the output of the installation is showing it also includes the creation of an encrypted key. This is a self-generated and not public one. Indeed, it is also possible to use an existing public one.

domalab.com Install OpenSSH Ubuntu Server complete

First step would be to make sure the OpenSSH Server is running. The quickest way would be to issue the command:

“sudo systemctl status ssh”

The result would look something similar to this screenshot.

domalab.com Install OpenSSH Ubuntu Server service status

Next in order to make OpenSSH Server start at every boot of the Ubuntu Server it is just a matter to enable the automatic start of its daemon:

“sudo systemctl enable ssh”

This command will automatically create the necessary symbolic links.

domalab.com Install OpenSSH Ubuntu Server enable service

At this point it is time to test the OpenSSH Server connection from a different Host. For example a Windows machine running the putty SSH client. As soon as the connection is starting (and if the encryption certificate is not “known”) the first time a new message pops up asking to review the certificate connection details. This is normal for a first time connection when using a self-generated non-public certificate.

domalab.com Install OpenSSH Ubuntu Server putty certificate

Upon acceptance the OpenSSH Server allows the connection and remote execution of any commands in the “local” terminal. Very useful for management and scripting purposes.

domalab.com Install OpenSSH Ubuntu Server windows connection


دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *