{"id":25188,"date":"2024-02-26T10:17:19","date_gmt":"2024-02-26T10:17:19","guid":{"rendered":"https:\/\/linuxways.net\/?p=25188"},"modified":"2024-02-26T10:17:19","modified_gmt":"2024-02-26T10:17:19","slug":"install-enable-ssh-linux-mint-21","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/mint\/install-enable-ssh-linux-mint-21\/","title":{"rendered":"How to Install and Enable SSH on Linux Mint 21"},"content":{"rendered":"<p><strong>SSH <\/strong>(Secure Shell) is a well-known network protocol that enables secure and encrypted remote access to the systems or computers over a network. It permits users to remotely connect to the remote server system, and access its terminal (CLI) without physically being there.<\/p>\n<p>While working on Linux Mint, if you want to access another system, you can install and enable <strong>SSH <\/strong>on your system. It will allow you to remotely control Linux, Unix, macOS, and Windows systems from other computers\/systems.<\/p>\n<p><strong>Overview<\/strong><\/p>\n<ul>\n<li><a href=\"#post-25188-_55ws2uchaj36\"><strong>How to Install SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_mqawr95clqwy\"><strong>How to Enable SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_tmmr28pymay5\"><strong>How to Access Remote Server Via SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_90dxta1nhck\"><strong>How to Configure SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_5fmkbf8ubqlq\"><strong>How to Transfer\/Share Files Using SSH in Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_gz0fqrmymg9n\"><strong>How to Disable SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_ht1qw9whqok5\"><strong>How to Uninstall\/Remove SSH on Linux Mint 21<\/strong><\/a><\/li>\n<li><a href=\"#post-25188-_fdnikrxulgq8\"><strong>Conclusion <\/strong><\/a><\/li>\n<\/ul>\n<h2><a id=\"post-25188-_55ws2uchaj36\"><\/a>How to Install SSH on Linux Mint 21<\/h2>\n<p>To install <strong>SSH <\/strong>on Linux Mint, you have to install the \u201c<strong>ssh<\/strong>\u201d package from the default Linux Mint repository. It contains the necessary dependencies for setting up an <strong>SSH <\/strong>server on Linux Mint:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p>This command will successfully install <strong>SSH <\/strong>along with the additional packages on the system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"388\" class=\"wp-image-25200\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-1.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-1-300x156.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<h2><a id=\"post-25188-_mqawr95clqwy\"><\/a>How to Enable SSH on Linux Mint 21<\/h2>\n<p>The <strong>SSH <\/strong>service is enabled automatically after installing <strong>SSH <\/strong>on the system. However, if it is not enabled, you will have to enable it manually using the below-listed command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"169\" class=\"wp-image-25203\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-2.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-2-300x68.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<p>Next, enter the given command to start the <strong>SSH <\/strong>service:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl start <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"104\" class=\"wp-image-25207\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-3.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-3-300x42.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<p>To verify whether the <strong>SSH <\/strong>service is enabled or not, check its status:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl status <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p>The <strong>SSH <\/strong>service is enabled and is running successfully as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"388\" class=\"wp-image-25214\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-4.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-4-300x156.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<h3><a id=\"post-25188-_hb7pw1xqbmlw\"><\/a>Enable SSH Connections Through Firewall<\/h3>\n<p>On Linux Mint, the firewall may restrict the incoming <strong>SSH <\/strong>connections on the server side. In such circumstances, you will have to configure the firewall to allow incoming client-side <strong>SSH <\/strong>traffic using the provided steps:<\/p>\n<p>First, enable <strong>SSH <\/strong>connections through the firewall using the below-given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw allow <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"147\" class=\"wp-image-25218\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-5.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-5-300x60.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<p>Then, write out the provided command to enable the firewall:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw <span class=\"kw3\">enable<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"123\" class=\"wp-image-25222\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-6.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-6-300x50.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<p>Next, restart the firewall to implement changes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw reload<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"126\" class=\"wp-image-25226\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-7.png 735w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-7-300x51.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>Finally, check the status of the firewall in detail for verification:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw status verbose<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"321\" class=\"wp-image-25231\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-8.png 736w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-8-300x131.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<h2><a id=\"post-25188-_tmmr28pymay5\"><\/a>How to Access Remote Server Via SSH on Linux Mint 21<\/h2>\n<p>To connect to a specific remote server system and access it from another system\/computer, use the below-mentioned command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">ssh<\/span> <span class=\"sy0\">&lt;<\/span>username<span class=\"sy0\">@<\/span>system-ip-address<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Make sure to replace the \u201c<strong>username<\/strong>\u201d with your username on the remote system and \u201c<strong>system-ip-address<\/strong>\u201d with the remote server system\u2019s IP address.<\/p>\n<p><strong>Note:<\/strong> On Linux, Windows, and macOS, you can find the username through the \u201c<strong>whoami<\/strong>\u201d command. To find the IP address on Linux and macOS systems, use the \u201c<strong>ifconfig<\/strong>\u201d command, and for Windows, use the \u201c<strong>ipconfig<\/strong>\u201d command.<\/p>\n<p>Consider the provided examples to understand how we can access remote systems from different devices.<\/p>\n<h3><a id=\"post-25188-_nhzo9915iwo4\"><\/a>Example 1: Access Your Linux Mint Server System on a Windows Client System<\/h3>\n<p>In this example, we will access our Linux Mint server on a Windows (client) computer. For this purpose, open the Windows terminal and execute the below-listed command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">ssh<\/span> linuxways<span class=\"sy0\">@<\/span>192.168.70.145<\/div><\/div>\n<p>Here, \u201c<strong>linuxways<\/strong>\u201d is the username, and \u201c<strong>192.168.70.145<\/strong>\u201d is the IP address of our server Linux Mint system.<\/p>\n<p>After executing the above command, you will have to provide the password of the server system you are connecting to i.e. \u201clinuxways@192.168.70.145\u201d. Subsequently, the Linux Mint server system will be accessed on the Windows system successfully as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"313\" class=\"wp-image-25236\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-9.png 673w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-9-300x140.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/p>\n<p>If you want to terminate the connection, type out the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">exit<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"128\" class=\"wp-image-25242\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-10.png 672w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-10-300x57.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/p>\n<h3><a id=\"post-25188-_3qmx0lrpzco2\"><\/a>Example 2: Access a Debian Server System on Your Linux Mint Client System<\/h3>\n<p>In this example, we will access a Debian server system on our Linux Mint client system. We are executing the given command on the Linux Mint terminal and providing the username and IP address of the server Debian system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">ssh<\/span> laiba<span class=\"sy0\">@<\/span>192.168.70.146<\/div><\/div>\n<p>Here, \u201c<strong>laiba<\/strong>\u201d is the Debian server system\u2019s username, and \u201c<strong>192.168.70.146<\/strong>\u201d is its IP address.<\/p>\n<p>We have successfully connected to our Debian server system as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"478\" class=\"wp-image-25246\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-11.png 725w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-11-300x198.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<h2><a id=\"post-25188-_90dxta1nhck\"><\/a>How to Configure SSH on Linux Mint 21<\/h2>\n<p>If you want to enhance the security of the <strong>SSH <\/strong>server, you can configure it on your Linux Mint system in the <strong>SSH <\/strong>configuration file. You can make changes to the <strong>SSH <\/strong>server\u2019s settings, such as changing the port number, limiting root login, controlling user access, and many more. To do so, use the given command to open the configuration file in the editor:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>ssh<span class=\"sy0\">\/<\/span>sshd_config<\/div><\/div>\n<p>The file has been opened as seen below: <img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"543\" class=\"wp-image-25251\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-12.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-12-300x228.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>Now, you can make the desired changes in this configuration file. Go through the provided examples to understand how we can configure SSH on the system.<\/p>\n<h3><a id=\"post-25188-_g6z3vv51jvhj\"><\/a>Change Default SSH Port<\/h3>\n<p>The default <strong>SSH <\/strong>port is \u201c<strong>22<\/strong>\u201d as it listens on it by default. However, you can change this port number to access <strong>SSH <\/strong>on any desired port. To change the <strong>SSH <\/strong>port in the <strong>SSH <\/strong>configuration file, you have to uncomment the \u201c<strong>#Port 22<\/strong>\u201d line and change it with the specific port number. For instance, we are assigning \u201c<strong>7777<\/strong>\u201d as the new port number.<\/p>\n<p><strong>Note: <\/strong>Before assigning the new port number, ensure that the port is free and not being used by another service. You can check the availability of the new port through \u201c<strong>sudo netstat -tulpn | grep &#8216;:&lt;port-no&gt;&#8217;<\/strong>\u201d command.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"498\" class=\"wp-image-25255\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-13.png 698w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-13-300x214.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"496\" class=\"wp-image-25261\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-14.png 696w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-14-300x214.png 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p>\n<p>Save modifications and close the file by pressing \u201c<strong>CTRL + S<\/strong>\u201d and \u201c<strong>CTRL +X<\/strong>\u201d.<\/p>\n<p>After that, update the firewall rule to enable SSH connection on the new port i.e \u201c7777\u201d using the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw allow <span class=\"nu0\">7777<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"145\" class=\"wp-image-25268\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-15.png 732w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-15-300x59.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/p>\n<p>Implement new changes by restarting the firewall on the system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw reload<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"125\" class=\"wp-image-25275\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-16.png 735w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-16-300x51.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>You will also have to restart the <strong>SSH <\/strong>service:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl restart <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"102\" class=\"wp-image-25279\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-17.png 735w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-17-300x42.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>Finally, view the <strong>SSH <\/strong>listening port to ensure that it is now listening to the new port:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> lsof <span class=\"re5\">-i<\/span> <span class=\"re5\">-P<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p>According to the below output the <strong>SSH <\/strong>is listening to the new \u201c<strong>7777<\/strong>\u201d port:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"149\" class=\"wp-image-25280\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-18.png 734w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-18-300x61.png 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/p>\n<h3><a id=\"post-25188-_ql5ex6f3d66m\"><\/a>Limit SSH User Login and Access<\/h3>\n<p>If you do not want everyone to access your server system, you can limit the <strong>SSH <\/strong>access to specific users. To allow access to certain users, you have to add the \u201c<strong>AllowUsers<\/strong>\u201d line along with the specified usernames at the end of the <strong>SSH <\/strong>configuration file.<\/p>\n<p>Here, we are allowing access to only three systems with usernames \u201claiba\u201d, \u201ctestsystem\u201d, and \u201clinuxgenie\u201d. So, only these users are allowed to access the server system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"389\" class=\"wp-image-25285\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-19.png 699w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-19-300x167.png 300w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/p>\n<p>Similarly, you can make other changes in the SSH configuration file according to your needs.<\/p>\n<h2><a id=\"post-25188-_5fmkbf8ubqlq\"><\/a>How to Transfer\/Share Files Using SSH in Linux Mint 21<\/h2>\n<p><strong>SSH <\/strong>also enables users to safely transfer files between remote servers and local client systems using \u201cscp\u201d. The SCP is a secure copy protocol for securely transferring\/copying files and directories between systems. Check out the following cases to see how we can transfer files over SSH in Linux Mint.<\/p>\n<p><strong>Note: <\/strong>You will need the file\u2019s path while transferring it. Use the \u201c<strong>realpath &lt;file-name&gt;<\/strong>\u201d command to get the file\u2019s path.<\/p>\n<h3><a id=\"post-25188-_5w531sbuzmpe\"><\/a>Case 1: Transfer Files From the Remote Server to the Local System<\/h3>\n<p>To copy or share the desired file from the remote system server to the local system, you can utilize the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">scp<\/span> <span class=\"sy0\">&lt;<\/span>remote-server-username<span class=\"sy0\">&gt;@&lt;<\/span>remote-server-ip<span class=\"sy0\">&gt;<\/span>:<span class=\"sy0\">&lt;<\/span>remote<span class=\"sy0\">\/<\/span>directory<span class=\"sy0\">\/<\/span>file<span class=\"sy0\">\/<\/span>path<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">&lt;<\/span>local<span class=\"sy0\">\/<\/span>directory<span class=\"sy0\">\/<\/span>path<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>For instance, we are copying a \u201c<strong>test1.txt<\/strong>\u201d file from the remote server to our local system in a specific directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">scp<\/span> laiba<span class=\"sy0\">@<\/span>192.168.70.147:<span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>laiba<span class=\"sy0\">\/<\/span>Downloads<span class=\"sy0\">\/<\/span>test1.txt ~<span class=\"sy0\">\/<\/span>Desktop<\/div><\/div>\n<p>Here,<\/p>\n<ul>\n<li>\u201c<strong>laiba@192.168.70.147<\/strong>\u201d is the remote server system\u2019s username and IP address respectively.<\/li>\n<li>\u201c<strong>\/home\/laiba\/Downloads\/test1.txt<\/strong>\u201d is the remote server\u2019s file path that is being copied.<\/li>\n<li>\u201c<strong>~\/Desktop<\/strong>\u201d is the local system\u2019s directory where the file will be copied.<\/li>\n<\/ul>\n<p>The below output shows the \u201c<strong>test1.txt<\/strong>\u201d file has been successfully copied from the remote server to our local system. You can also list the local directory\u2019s content where the file is copied for verification:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"236\" class=\"wp-image-25289\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-20.png 698w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-20-300x101.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p>\n<h3><a id=\"post-25188-_x432vsgd1k0s\"><\/a>Case 2: Transfer Files From the Local System to the Remote Server<\/h3>\n<p>To transfer\/share a file from the local system to the remote server, utilize the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">scp<\/span> <span class=\"sy0\">&lt;<\/span>local<span class=\"sy0\">\/<\/span>system<span class=\"sy0\">\/<\/span>file<span class=\"sy0\">\/<\/span>path<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">&lt;<\/span>remote-server-username<span class=\"sy0\">&gt;@&lt;<\/span>remote-server-ip<span class=\"sy0\">&gt;<\/span>:<span class=\"sy0\">&lt;<\/span>remote<span class=\"sy0\">\/<\/span>directory<span class=\"sy0\">\/<\/span>path<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>For example, we are transferring a \u201c<strong>demo.txt<\/strong>\u201d file from the local system to the remote server at a particular directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">scp<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>linuxways<span class=\"sy0\">\/<\/span>Documents<span class=\"sy0\">\/<\/span>demo.txt laiba<span class=\"sy0\">@<\/span>192.168.70.147:<span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>laiba<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p>Here:<\/p>\n<ul>\n<li>\u201c\/<strong>home\/linuxways\/Documents\/demo.txt<\/strong>\u201d is the local directory file\u2019s path that is being transferred.<\/li>\n<li>\u201c<strong>laiba@192.168.70.147<\/strong>\u201d is the remote server\u2019s username and IP address respectively.<\/li>\n<li>\u201c<strong>\/home\/laiba\/<\/strong>\u201d is the remote directory where the file will be transferred.<\/li>\n<\/ul>\n<p>The file has been successfully transferred from the local system to the remote server:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"170\" class=\"wp-image-25291\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-21.png 700w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-21-300x73.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>For verification, you can access the remote server and list the directory content where the file has been transferred:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"429\" class=\"wp-image-25293\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-22.png 698w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-22-300x184.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p>\n<h2><a id=\"post-25188-_gz0fqrmymg9n\"><\/a>How to Disable SSH on Linux Mint 21<\/h2>\n<p>To disable the <strong>SSH <\/strong>on Linux Mint from starting automatically on the system boot, you have to stop the <strong>SSH <\/strong>service first using the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl stop <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"105\" class=\"wp-image-25294\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-23.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-23-300x44.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>Then, disable the <strong>SSH <\/strong>service by utilizing the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl disable <span class=\"kw2\">ssh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"212\" class=\"wp-image-25296\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-24.png 716w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-24-300x89.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/p>\n<h2><a id=\"post-25188-_ht1qw9whqok5\"><\/a>How to Uninstall\/Remove SSH on Linux Mint 21<\/h2>\n<p>If you no longer need remote access to your remote systems, you can uninstall\/remove <strong>SSH <\/strong>from your Linux Mint system via the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt autoremove <span class=\"kw2\">ssh<\/span> <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"305\" class=\"wp-image-25297\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-25.png 725w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25188-25-300x126.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>That was all about <strong>SSH <\/strong>on Linux Mint.<\/p>\n<h2><a id=\"post-25188-_fdnikrxulgq8\"><\/a>Conclusion<\/h2>\n<p><strong>SSH <\/strong>offers an encrypted and secure way to remotely access and control systems, transfer files over the network, and perform administrative tasks. You can install <strong>SSH <\/strong>on Linux Mint systems from the default Linux Mint repository and enable it on the system. Additionally, you can make the desired changes in the <strong>SSH <\/strong>configuration file to configure the <strong>SSH <\/strong>server. This guide has covered the step-by-step instructions to install, enable, and configure <strong>SSH <\/strong>on Linux Mint systems.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>You can install and enable SSH on Linux Mint systems using the \u201csudo apt install ssh\u201d and \u201csudo systemctl enable ssh\u201d commands respectively.<\/p>","protected":false},"author":112,"featured_media":25309,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-25188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mint"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/25188","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\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=25188"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/25188\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/25309"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=25188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=25188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=25188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}