{"id":1890,"date":"2023-02-09T08:20:23","date_gmt":"2023-02-09T08:20:23","guid":{"rendered":"https:\/\/matob.web.id\/news\/?p=1890"},"modified":"2023-02-09T08:20:23","modified_gmt":"2023-02-09T08:20:23","slug":"how-to-install-and-enable-ssh-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/matob.web.id\/news\/how-to-install-and-enable-ssh-on-ubuntu-18-04\/","title":{"rendered":"How To Install and Enable SSH on Ubuntu 18.04"},"content":{"rendered":"<p><strong>How To Install and Enable SSH on Ubuntu 18.04 &#8211;<\/strong> Secure Shell (SSH) is a cryptographic network protocol used for secure connections between clients and servers.<\/p>\n<p>In this tutorial, I will show you <a href=\"https:\/\/matob.web.id\/random\/software\/how-to-install-and-enable-ssh-on-ubuntu-18-04\/\">how to install and enable SSH on Ubuntu<\/a> Desktop operating system. Enabling SSH will allow you to remotely or remotely connect to your Ubuntu computer and securely transfer files or perform administrative tasks.<\/p>\n<h3>Condition<\/h3>\n<p>Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.<\/p>\n<h3>How to Enable SSH on Ubuntu<\/h3>\n<p>The SSH server is not installed by default on Ubuntu desktop systems but can be easily installed from the standard Ubuntu repositories.<\/p>\n<p>To install and enable SSH on your Ubuntu system, perform the following steps:<\/p>\n<p>Open your terminal by using the\u00a0<code>Ctrl+Alt+T\u00a0<\/code>keyboard shortcut or by clicking on the terminal icon and install the package\u00a0<code>openssh-server\u00a0<\/code>by typing:<\/p>\n<p><code>$ sudo apt update<br \/>\n$ sudo apt install openssh-server<\/code><\/p>\n<p>Enter the password when prompted and enter it\u00a0<code>Y\u00a0<\/code>to continue the installation.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2524 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2022\/02\/ssh-on-ubuntu-1.jpg\" alt=\"ssh on ubuntu 1\" width=\"768\" height=\"576\" title=\"\"><\/p>\n<p>After the installation is complete, the SSH service will start automatically.\u00a0To verify that the installation was successful and the SSH service is running type the following command which will print the SSH server status:<\/p>\n<p><code>$ sudo systemctl status ssh<\/code><\/p>\n<p>You will see something like\u00a0<code>Active: active (running)\u00a0<\/code>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2525 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2022\/02\/ssh-on-ubuntu-2.jpg\" alt=\"ssh on ubuntu 2\" width=\"768\" height=\"576\" title=\"\"><\/p>\n<p>Press\u00a0<code>q\u00a0<\/code>to return to the command line prompt.<\/p>\n<p>Ubuntu comes with a firewall configuration tool called UFW.\u00a0If a firewall is enabled on your system, make sure to open the SSH port:<\/p>\n<p><code>$ sudo ufw allow ssh<\/code><\/p>\n<p>Now that SSH is installed and running on your Ubuntu system, you can connect via <a href=\"https:\/\/matob.web.id\/random\/technology\/ssh\/\">SSH<\/a> from any remote computer.\u00a0Linux and macOS systems have an SSH client installed by default.\u00a0If you want to connect from a Windows computer then you can use an SSH client like PuTTY.<\/p>\n<h3>Connecting to SSH Via LAN<\/h3>\n<p>To connect to your Ubuntu computer via LAN, you just need to enter the following command:<\/p>\n<p><code>$ ssh username@ip_address<\/code><\/p>\n<p>Change the username with the actual username and\u00a0<code>ip_address\u00a0<\/code>with the IP Address of the Ubuntu computer where you installed SSH.<\/p>\n<p>If you don&#8217;t know your IP address, you can easily find it using the ip command:<\/p>\n<p><code>$ ip a<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2526 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2022\/02\/ssh-on-ubuntu-3.jpg\" alt=\"\" width=\"590\" height=\"443\" title=\"\"><\/p>\n<p>As you can see from the output, the system IP address is\u00a0<code>192.168.121.111\u00a0<\/code>.<\/p>\n<p>Once you find the IP address, log in to the remote computer by running the following ssh command:<\/p>\n<p><code>$ ssh centerklik@192.168.121.111<\/code><\/p>\n<p>When you connect via SSH for the first time, you will see a message that looks like this:<\/p>\n<pre><code>\r\n\t\tOutputThe authenticity of host '192.168.121.111 (192.168.121.111)' can't be established.ECDSA key fingerprint is SHA256:Vybt22mVXuNuB5unE++yowF7lgA\/9\/2bLSiO3qmYWBY.Are you sure you want to continue connecting (yes\/no)?\r\n\t<\/code><\/pre>\n<p>Type\u00a0<code>yes\u00a0<\/code>it and you will be asked to enter a password or password.<\/p>\n<pre>\tOutputWarning: Permanently added '192.168.121.111' (ECDSA) to the list of known hosts.centerklik@192.168.121.111's password:\r\n<\/pre>\n<p>Once you enter your password, you will be greeted with a message similar to the one below.<\/p>\n<pre>\tOutputWelcome to Ubuntu 18.04.1 LTS (GNU\/Linux 4.15.0-33-generic x86_64) * Documentation: https:\/\/help.ubuntu.com * Management: https:\/\/landscape.canonical.com * Support: .\r\n<\/pre>\n<p>You are now logged into your Ubuntu computer.<\/p>\n<h3>How to Connect to SSH Over the Internet<\/h3>\n<p>To connect to your <a href=\"https:\/\/matob.web.id\/random\/technology\/main-advantages-of-ubuntu-linux\/\">Ubuntu<\/a> computer via the Internet, you will need to know your public IP Address and configure your router to receive data on the port\u00a0<code>22\u00a0<\/code>and send it to the Ubuntu computer where SSH is running.<\/p>\n<p>To determine the public IP address of the computer you are trying to SSH on, simply visit the following URL: https:\/\/ifconfig.co\/ip.<\/p>\n<p>When setting up port forwarding, each router has a different way of setting up port forwarding.\u00a0You should consult your router&#8217;s documentation on how to set up port forwarding.\u00a0In short, you need to enter the port number on which the request will be made (default SSH port is 22) and the private IP address you found earlier (using the ip a command) of the computer on which SSH is running.<\/p>\n<p>Once you&#8217;ve found the IP address, and configured your router, you can log in by typing:<\/p>\n<p><code>$ ssh username@public_ip_address<\/code><\/p>\n<p>If you expose your computer to the Internet, it is a good idea to implement some security measures.\u00a0The most basic is configuring your router to accept SSH traffic on non-standard ports and to forward it to port 22 on the computer running the SSH service.<\/p>\n<p>You can also set up SSH key based authentication and connect to your Ubuntu computer without entering a password.<\/p>\n<h3>How to Disable SSH on Ubuntu<\/h3>\n<p>If for some reason you want to disable SSH on your Ubuntu computer, you can stop the SSH service by running:<\/p>\n<p><code>$ sudo systemctl stop ssh<\/code><\/p>\n<p>To start it again run:<\/p>\n<p><code>$ sudo systemctl start ssh<\/code><\/p>\n<p>To disable the SSH service to start during system boot:<\/p>\n<p><code>$ sudo systemctl disable ssh<\/code><\/p>\n<p>To enable it again type:<\/p>\n<p><code>$ sudo systemctl enable ssh<\/code><\/p>\n<h3>Conclusion<\/h3>\n<p>You have learned how to install and enable SSH on your Ubuntu 18.04.\u00a0You can now log into your computer and perform common sysadmin tasks via the command prompt.<\/p>\n<p>By default, SSH listens on port 22. Changing the default SSH port adds an extra layer of security to your server by reducing the risk of automated attacks.<\/p>\n<p>If you manage multiple systems, you can simplify your workflow by defining all your connections in the SSH configuration file.<\/p>\n<p>Secure Shell (SSH) is a cryptographic network protocol used for secure connections between clients and servers.<\/p>\n<p>In this tutorial, I will show you how to install and enable SSH on the Ubuntu Desktop operating system.\u00a0Enabling SSH will allow you to remotely or remotely connect to your Ubuntu computer and securely transfer files or perform administrative tasks.<\/p>\n<h3>Condition<\/h3>\n<p>Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.<\/p>\n<h3>How to Enable SSH on Ubuntu<\/h3>\n<p>The SSH server is not installed by default on Ubuntu desktop systems but can be easily installed from the standard Ubuntu repositories.<\/p>\n<p>To install and enable SSH on your Ubuntu system, perform the following steps:<\/p>\n<p>Open your terminal by using the\u00a0<code>Ctrl+Alt+T\u00a0<\/code>keyboard shortcut or by clicking on the terminal icon and install the package\u00a0<code>openssh-server\u00a0<\/code>by typing:<\/p>\n<p><code>$ sudo apt update<br \/>\n$ sudo apt install openssh-server<\/code><\/p>\n<p>Enter the password when prompted and enter it\u00a0<code>Y\u00a0<\/code>to continue the installation.<\/p>\n<p>After the installation is complete, the SSH service will start automatically.\u00a0To verify that the installation was successful and the SSH service is running type the following command which will print the SSH server status:<\/p>\n<p><code>$ sudo systemctl status ssh<\/code><\/p>\n<p>You will see something like\u00a0<code>Active: active (running)\u00a0<\/code>:<\/p>\n<p>Press\u00a0<code>q\u00a0<\/code>to return to the command line prompt.<\/p>\n<p>Ubuntu comes with a firewall configuration tool called UFW.\u00a0If a firewall is enabled on your system, make sure to open the SSH port:<\/p>\n<p><code>$ sudo ufw allow ssh<\/code><\/p>\n<p>Now that SSH is installed and running on your Ubuntu system, you can connect via SSH from any remote computer.\u00a0Linux and macOS systems have an SSH client installed by default.\u00a0If you want to connect from a Windows computer then you can use an SSH client like PuTTY.<\/p>\n<h3>Connecting to SSH Via LAN<\/h3>\n<p>To connect to your Ubuntu computer via LAN, you just need to enter the following command:<\/p>\n<p><code>$ ssh username@ip_address<\/code><\/p>\n<p>Change the username with the actual username and\u00a0<code>ip_address\u00a0<\/code>with the IP Address of the Ubuntu computer where you installed SSH.<\/p>\n<p>If you don&#8217;t know your IP address, you can easily find it using the ip command:<\/p>\n<p><code>$ ip a<\/code><\/p>\n<p>As you can see from the output, the system IP address is\u00a0<code>192.168.121.111\u00a0<\/code>.<\/p>\n<p>Once you find the IP address, log in to the remote computer by running the following ssh command:<\/p>\n<p><code>$ ssh centerklik@192.168.121.111<\/code><\/p>\n<p>When you connect via SSH for the first time, you will see a message that looks like this:<\/p>\n<pre><code>\r\n\t\tOutputThe authenticity of host '192.168.121.111 (192.168.121.111)' can't be established.ECDSA key fingerprint is SHA256:Vybt22mVXuNuB5unE++yowF7lgA\/9\/2bLSiO3qmYWBY.Are you sure you want to continue connecting (yes\/no)?\r\n\t<\/code><\/pre>\n<p>Type\u00a0<code>yes\u00a0<\/code>it and you will be asked to enter a password or password.<\/p>\n<pre>\tOutputWarning: Permanently added '192.168.121.111' (ECDSA) to the list of known hosts.centerklik@192.168.121.111's password:\r\n<\/pre>\n<p>Once you enter your password, you will be greeted with a message similar to the one below.<\/p>\n<pre>\tOutputWelcome to Ubuntu 18.04.1 LTS (GNU\/Linux 4.15.0-33-generic x86_64) * Documentation: https:\/\/help.ubuntu.com * Management: https:\/\/landscape.canonical.com * Support: .\r\n<\/pre>\n<p>You are now logged into your Ubuntu computer.<\/p>\n<h3>How to Connect to SSH Over the Internet<\/h3>\n<p>To connect to your Ubuntu computer via the Internet, you will need to know your public IP Address and configure your router to receive data on the port\u00a0<code>22\u00a0<\/code>and send it to the Ubuntu computer where SSH is running.<\/p>\n<p>To determine the public IP address of the computer you are trying to SSH on, simply visit the following URL: https:\/\/ifconfig.co\/ip.<\/p>\n<p>When setting up port forwarding, each router has a different way of setting up port forwarding.\u00a0You should consult your router&#8217;s documentation on how to set up port forwarding.\u00a0In short, you need to enter the port number on which the request will be made (default SSH port is 22) and the private IP address you found earlier (using the ip a command) of the computer on which SSH is running.<\/p>\n<p>Once you&#8217;ve found the IP address, and configured your router, you can log in by typing:<\/p>\n<p><code>$ ssh username@public_ip_address<\/code><\/p>\n<p>If you expose your computer to the Internet, it is a good idea to implement some security measures.\u00a0The most basic is configuring your router to accept SSH traffic on non-standard ports and to forward it to port 22 on the computer running the SSH service.<\/p>\n<p>You can also set up SSH key based authentication and connect to your Ubuntu computer without entering a password.<\/p>\n<h3>How to Disable SSH on Ubuntu<\/h3>\n<p>If for some reason you want to disable SSH on your Ubuntu computer, you can stop the SSH service by running:<\/p>\n<p><code>$ sudo systemctl stop ssh<\/code><\/p>\n<p>To start it again run:<\/p>\n<p><code>$ sudo systemctl start ssh<\/code><\/p>\n<p>To disable the SSH service to start during system boot:<\/p>\n<p><code>$ sudo systemctl disable ssh<\/code><\/p>\n<p>To enable it again type:<\/p>\n<p><code>$ sudo systemctl enable ssh<\/code><\/p>\n<h3>Conclusion<\/h3>\n<p>You have learned how to install and enable SSH on your Ubuntu 18.04.\u00a0You can now log into your computer and perform common sysadmin tasks via the command prompt.<\/p>\n<p>By default, SSH listens on port 22. Changing the default SSH port adds an extra layer of security to your server by reducing the risk of automated attacks.<\/p>\n<p>If you manage multiple systems, you can simplify your workflow by defining all your connections in the SSH configuration file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How To Install and Enable SSH on Ubuntu 18.04 &#8211; Secure Shell (SSH) is a cryptographic network protocol used for secure connections between clients and servers. In this tutorial, I will show you how to install and enable SSH on Ubuntu Desktop operating system. Enabling SSH will allow you to remotely or remotely connect to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1891,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1890","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software"],"_links":{"self":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts\/1890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/comments?post=1890"}],"version-history":[{"count":1,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts\/1890\/revisions"}],"predecessor-version":[{"id":1892,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts\/1890\/revisions\/1892"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/media\/1891"}],"wp:attachment":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/media?parent=1890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/categories?post=1890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/tags?post=1890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}