{"id":16642,"date":"2022-04-16T15:11:14","date_gmt":"2022-04-16T15:11:14","guid":{"rendered":"https:\/\/linuxways.net\/?p=16642"},"modified":"2022-04-16T15:11:14","modified_gmt":"2022-04-16T15:11:14","slug":"how-to-install-openssh-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-openssh-on-ubuntu-20-04\/","title":{"rendered":"How to Install OpenSSH on Ubuntu 20.04"},"content":{"rendered":"<h2>What is OpenSSH?<\/h2>\n<p>OpenSSH is a connectivity tool that allows secure communication between client and server. The traffic is encrypted to discourage eavesdropping, connection hijacking, MITM attack, and other attacks.<\/p>\n<p>In today\u2019s guide, we will show you how to install OpenSSH server on an ubuntu machine. The installation will take place using the terminal with the help of a few easy-to-follow commands.<\/p>\n<p>Let\u2019s get started!<\/p>\n<h2>Installation Guide:<\/h2>\n<p>Following are the steps involved in installing OpenSSH server in Ubuntu:<\/p>\n<h3>Step 1: Install OpenSSH Server<\/h3>\n<p>To install OpenSSH server, issue the following command:<\/p>\n<pre>sudo apt-get install openssh-server<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"321\" height=\"26\" class=\"wp-image-16643\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-120.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-120.png 321w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-120-300x24.png 300w\" sizes=\"auto, (max-width: 321px) 100vw, 321px\" \/><\/p>\n<h3>Step 2: Enable SSH<\/h3>\n<p>In this step, we will enable SSH to allow log in from remote machines. It can be done by running the following command:<\/p>\n<pre>sudo systemctl enable ssh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"236\" height=\"27\" class=\"wp-image-16644\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-121.png\" \/><\/p>\n<h3>Step 3: Start SSH<\/h3>\n<p>Now that we have enabled the service, let\u2019s start it. To do that, run this command:<\/p>\n<pre>sudo systemctl start ssh.<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"30\" class=\"wp-image-16645\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-122.png\" \/><\/p>\n<h3>Step 4: Test SSH Login<\/h3>\n<p>Now we will check whether we can access the server via ssh from a remote machine or not. To do that, log in to the system using your username and the IP address of the server machine.<\/p>\n<pre>ssh tom@10.254.153.43<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"188\" height=\"25\" class=\"wp-image-16646\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-123.png\" \/><\/p>\n<h2>OpenSSH server installation and configuration<\/h2>\n<h3>SSH to remote server using bmc\/kvm\/ipmi over IP<\/h3>\n<p>We are using OpenPOWER based system known as Talos II from Raptor computing systems. Since it does not come with SSH server installed on it, this is how we will log in to bmc server to get access to the serial console.<\/p>\n<pre>ssh root@power9-bmc<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"177\" height=\"26\" class=\"wp-image-16647\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-124.png\" \/><\/p>\n<h3>Run obmc console<\/h3>\n<p>To get access to the Ubuntu server console, run the obmc-console-client by executing this command:<\/p>\n<pre># obmc-console-client<\/pre>\n<h2>Install OpenSSH server on Ubuntu<\/h2>\n<h3>Step 1: Update the system<\/h3>\n<p>Firstly, update the system. To do that, execute the following command:<\/p>\n<pre>sudo apt update<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"142\" height=\"28\" class=\"wp-image-16648\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-125.png\" \/><\/p>\n<h3>Step 2: Upgrade the system<\/h3>\n<p>After updating, we will upgrade the system. Run the following command to do that:<\/p>\n<pre>sudo apt upgrade<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"161\" height=\"26\" class=\"wp-image-16649\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-126.png\" \/><\/p>\n<h3>Step 3: Install sshd server on Ubuntu<\/h3>\n<p>In this step, we will install the openssh-server package by issuing the following command:<\/p>\n<pre>sudo apt install openssh-server<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"287\" height=\"26\" class=\"wp-image-16650\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-127.png\" \/><\/p>\n<h3>Step 4: Check the status of the service<\/h3>\n<p>Let\u2019s verify whether the ssh service is running fine or not. Run this command to do that:<\/p>\n<pre>sudo systemctl status ssh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"231\" height=\"28\" class=\"wp-image-16651\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-128.png\" \/><\/p>\n<h3>Step 5: Enable and start SSH<\/h3>\n<p>Now, let\u2019s run the SSH service. First, enable it by running the following command:<\/p>\n<pre>sudo systemctl enable ssh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"236\" height=\"24\" class=\"wp-image-16652\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-129.png\" \/><\/p>\n<p>Once the service is enabled, start the service by issuing the following command:<\/p>\n<pre>sudo systemctl start ssh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"227\" height=\"24\" class=\"wp-image-16653\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-130.png\" \/><\/p>\n<h2>Configure Firewall and open port 22<\/h2>\n<p>We also need to allow SSH service through firewall. To do that, we will configure ufw, the firewall present in Ubuntu.<\/p>\n<h3>Allow SSH<\/h3>\n<p>To allow SSH on ufw, run this command:<\/p>\n<pre>sudo ufw allow ssh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"168\" height=\"25\" class=\"wp-image-16654\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-131.png\" \/><\/p>\n<h3>Enable SSH<\/h3>\n<p>Next, we will enable SSH. It can be done by running the following command:<\/p>\n<pre>sudo ufw enable<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"141\" height=\"24\" class=\"wp-image-16655\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-132.png\" \/><\/p>\n<h3>Check firewall status<\/h3>\n<p>Now check the status of the ufw firewall by running the following command:<\/p>\n<pre>sudo ufw status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"145\" height=\"25\" class=\"wp-image-16656\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-133.png\" \/><\/p>\n<h2>Test SSH login<\/h2>\n<h3>SSH to the OpenSSH server<\/h3>\n<p>You can now log in OpenSSH server from a desktop machine using SSH. It can be done this way:<\/p>\n<pre>ssh tom@10.254.153.43<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"196\" height=\"22\" class=\"wp-image-16657\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-134.png\" \/><\/p>\n<pre>ssh tom@power9<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"135\" height=\"24\" class=\"wp-image-16658\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-135.png\" \/><\/p>\n<h3>Enable password less access<\/h3>\n<p>To allow password less login, you can copy and install the public key using ssh-copy-id command like this:<\/p>\n<pre>ssh-copy-id tom@power9<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"23\" class=\"wp-image-16659\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-136.png\" \/><\/p>\n<p>That\u2019s all folks!<\/p>\n<p>In this tutorial, we had a thorough look at how to install OpenSSH server on Ubuntu 20.04. We also saw how we can configure it for remote access and how to allow SSH service through Ubuntu\u2019s firewall.<\/p>\n<p>I hope you had a great learning time here.<\/p>\n<p>To see how you can enable SSH on Ubuntu 20.04, check this out:<\/p>\n<p><a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-enable-ssh-on-ubuntu-20-04\/\">https:\/\/linuxways.net\/ubuntu\/how-to-enable-ssh-on-ubuntu-20-04\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>What is OpenSSH? OpenSSH is a connectivity tool that allows secure communication between client and server. The traffic is encrypted to discourage eavesdropping, connection hijacking, MITM attack, and&hellip;<\/p>","protected":false},"author":1,"featured_media":16678,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[972,100],"class_list":["post-16642","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-openssh","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=16642"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16642\/revisions"}],"predecessor-version":[{"id":16677,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16642\/revisions\/16677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/16678"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=16642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=16642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=16642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}