CINXE.COM

SSH - Debian Wiki

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="/htdocs/favicon.ico"> <script type="text/javascript" src="/htdocs/bugstatus.js"></script> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta name="robots" content="noindex,nofollow"> <title>SSH - Debian Wiki</title> <script type="text/javascript" src="/htdocs/common/js/common.js"></script> <script type="text/javascript"> <!-- var search_hint = "Search"; //--> </script> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debwiki/css/common.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="/htdocs/debwiki/css/screen.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="/htdocs/debwiki/css/print.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="/htdocs/debwiki/css/projection.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debian-wiki-1.0.css"> <!-- css only for MS IE6/IE7 browsers --> <!--[if lt IE 8]> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debwiki/css/msie.css"> <![endif]--> <link rel="alternate" title="Debian Wiki: SSH" href="/SSH?diffs=1&amp;show_att=1&amp;action=rss_rc&amp;unique=0&amp;page=SSH&amp;ddiffs=1" type="application/rss+xml"> <link rel="Start" href="/FrontPage"> <link rel="Alternate" title="Wiki Markup" href="/SSH?action=raw"> <link rel="Alternate" media="print" title="Print View" href="/SSH?action=print"> <link rel="Search" href="/FindPage"> <link rel="Index" href="/TitleIndex"> <link rel="Glossary" href="/WordIndex"> <link rel="Help" href="/HelpOnFormatting"> </head> <body lang="en" dir="ltr"> <div id="logo"><a href="https://www.debian.org" title="Debian Homepage"><img src="https://www.debian.org/Pics/openlogo-50.png" alt="Debian" width="50" height="61"></a></div> <div id="header"> <div id="wikisection"> <p class="section"><a href="/FrontPage" title="Debian Wiki Homepage">Wiki</a></p> <div id="username"><a href="/SSH?action=login" id="login" rel="nofollow">Login</a></div> </div> <div id="navbar"> <ul id="navibar"> <li class="wikilink"><a href="/FrontPage">FrontPage</a></li><li class="wikilink"><a href="/RecentChanges">RecentChanges</a></li><li class="wikilink"><a href="/FindPage">FindPage</a></li><li class="wikilink"><a href="/HelpContents">HelpContents</a></li><li class="current"><a href="/SSH">SSH</a></li> </ul> </div> <form id="searchform" method="get" action="/SSH"> <div> <input type="hidden" name="action" value="fullsearch"> <input type="hidden" name="context" value="180"> <label for="searchinput">Search:</label> <input id="searchinput" type="text" name="value" value="" size="20" onfocus="searchFocus(this)" onblur="searchBlur(this)" onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search"> <input id="titlesearch" name="titlesearch" type="submit" value="Titles" alt="Search Titles"> <input id="fullsearch" name="fullsearch" type="submit" value="Text" alt="Search Full Text"> </div> </form> <script type="text/javascript"> <!--// Initialize search form var f = document.getElementById('searchform'); f.getElementsByTagName('label')[0].style.display = 'none'; var e = document.getElementById('searchinput'); searchChange(e); searchBlur(e); //--> </script> <div id="logo"><a href="https://www.debian.org" title="Debian Homepage"><img src="https://www.debian.org/Pics/openlogo-50.png" alt="Debian" width="50" height="61"></a></div> <div id="breadcrumbs"><a href="/FrontPage" title="Debian Wiki Homepage">Wiki</a><span class="sep">/</span> </div> <ul class="editbar"><li><a href="/SSH?action=login" id="login-1" rel="nofollow">Login</a></li><li class="toggleCommentsButton" style="display:none;"><a href="#" class="nbcomment" onClick="toggleComments();return false;">Comments</a></li><li><a class="nbinfo" href="/SSH?action=info" rel="nofollow">Info</a></li><li><a class="nbattachments" href="/SSH?action=AttachFile" rel="nofollow">Attachments</a></li><li> <form class="actionsmenu" method="GET" action="/SSH"> <div> <label>More Actions:</label> <select name="action" onchange="if ((this.selectedIndex != 0) && (this.options[this.selectedIndex].disabled == false)) { this.form.submit(); } this.selectedIndex = 0;"> <option value="raw">Raw Text</option> <option value="print">Print View</option> <option value="RenderAsDocbook">Render as Docbook</option> <option value="show" disabled class="disabled">Delete Cache</option> <option value="show" disabled class="disabled">------------------------</option> <option value="SpellCheck">Check Spelling</option> <option value="LikePages">Like Pages</option> <option value="LocalSiteMap">Local Site Map</option> <option value="show" disabled class="disabled">------------------------</option> <option value="RenamePage" disabled class="disabled">Rename Page</option> <option value="DeletePage" disabled class="disabled">Delete Page</option> <option value="show" disabled class="disabled">------------------------</option> <option value="show" disabled class="disabled">Subscribe User</option> <option value="show" disabled class="disabled">------------------------</option> <option value="show" disabled class="disabled">Remove Spam</option> <option value="show" disabled class="disabled">Revert to this revision</option> <option value="PackagePages">Package Pages</option> <option value="show" disabled class="disabled">------------------------</option> <option value="Load">Load</option> <option value="Save">Save</option> <option value="SlideShow">SlideShow</option> </select> <input type="submit" value="Do"> </div> <script type="text/javascript"> <!--// Init menu actionsMenuInit('More Actions:'); //--> </script> </form> </li></ul> <h1 id="locationline"> <ul id="pagelocation"> <li><a href="/SSH">SSH</a></li> </ul> </h1> </div> <div id="page" lang="en" dir="ltr"> <div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span> <span class="anchor" id="line-1"></span><span class="anchor" id="line-2"></span><span class="anchor" id="line-3"></span><span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span><span class="anchor" id="line-6"></span><p class="line867"><small><a href="/DebianWiki/EditorGuide#translation">Translation(s)</a>: <a href="/de/SSH">Deutsch</a> - <a href="/SSH">English</a> - <a href="/fr/SSH">Fran莽ais</a> - <a href="/it/SSH">Italiano</a> - <a href="/es/SSH">Espa帽ol</a> - <a href="/pt_BR/SSH">Portugu锚s (Brasil)</a></small> <span class="anchor" id="line-7"></span><span class="anchor" id="line-8"></span><span class="anchor" id="line-9"></span><span class="anchor" id="line-10"></span><p class="line867"><div class="table-of-contents"><p class="table-of-contents-heading">Contents<ol><li> <a href="#Introduction">Introduction</a></li><li> <a href="#Installation">Installation</a><ol><li> <a href="#Installation_of_the_client">Installation of the client</a></li><li> <a href="#Installation_of_the_server">Installation of the server</a></li></ol></li><li> <a href="#Configuration_files">Configuration files</a><ol><li> <a href="#Regenerating_host_keys">Regenerating host keys</a></li></ol></li><li> <a href="#Remote_login">Remote login</a><ol><li> <a href="#With_password">With password</a></li><li> <a href="#Using_shared_keys">Using shared keys</a></li></ol></li><li> <a href="#Keys_management">Keys management</a><ol><li> <a href="#Using_GUI">Using GUI</a></li></ol></li><li> <a href="#Securing">Securing</a><ol><li> <a href="#SSH_Server">SSH Server</a><ol><li> <a href="#Good_practices_with_SSH_Server">Good practices with SSH Server</a></li><li> <a href="#Configuration_Options">Configuration Options</a></li><li> <a href="#External_Utilities">External Utilities</a></li></ol></li><li> <a href="#SSH_Client">SSH Client</a><ol><li> <a href="#Good_practices_with_SSH_Client">Good practices with SSH Client</a></li></ol></li></ol></li><li> <a href="#Additional_Functions">Additional Functions</a><ol><li> <a href="#View_files_in_GUI">View files in GUI</a></li></ol></li><li> <a href="#Additional_Commands">Additional Commands</a><ol><li> <a href="#scp">scp</a></li><li> <a href="#sftp">sftp</a><ol><li> <a href="#text_mode">text mode</a></li><li> <a href="#graphical_mode">graphical mode</a></li></ol></li><li> <a href="#clusterssh">clusterssh</a></li><li> <a href="#ssh-agent_and_ssh-add">ssh-agent and ssh-add</a></li><li> <a href="#keychain">keychain</a></li><li> <a href="#ssh-askpass">ssh-askpass</a></li><li> <a href="#libpam-usb">libpam-usb</a></li></ol></li><li> <a href="#Remote_commands">Remote commands</a></li><li> <a href="#SSH_into_Debian_from_another_OS">SSH into Debian from another OS</a></li><li> <a href="#Good_practices_of_SSH_usage">Good practices of SSH usage</a></li><li> <a href="#Troubleshooting">Troubleshooting</a><ol><li> <a href="#OpenSSL_version_mismatch._Built_against_1000105f.2C_you_have_10001060">OpenSSL version mismatch. Built against 1000105f, you have 10001060</a></li><li> <a href="#SSH_hangs">SSH hangs</a><ol><li> <a href="#Resolution_with_IPQoS_0x00">Resolution with IPQoS 0x00</a></li><li> <a href="#Resolution_with_netcat">Resolution with netcat</a></li></ol></li><li> <a href="#Keep_SSH_connection_alive">Keep SSH connection alive</a><ol><li> <a href="#For_Debian_7.x_server">For Debian 7.x server</a></li></ol></li></ol></li><li> <a href="#See_also">See also</a></li></ol></li></ol></div><p class="line874"> <span class="anchor" id="line-11"></span><span class="anchor" id="line-12"></span><p class="line867"><a href="/ToDo"><strong class="highlight">ToDo</strong></a>: merge (and translate) this page and the french one (more complete) <span class="anchor" id="line-13"></span><span class="anchor" id="line-14"></span><p class="line867"> <h2 id="Introduction">Introduction</h2> <span class="anchor" id="line-15"></span><span class="anchor" id="line-16"></span><p class="line867"><strong>SSH</strong> stands for <strong>S</strong>ecure <strong>Sh</strong>ell and is a protocol for secure remote login and other secure network services over an insecure network<sup><a href="#fnref-0b2e6c997d8b83e2b9fc0c2fba2896d27f6d74f8" id="fndef-0b2e6c997d8b83e2b9fc0c2fba2896d27f6d74f8-0">1</a></sup>. <span class="anchor" id="line-17"></span>See <a class="interwiki" href="https://en.wikipedia.org/wiki/Secure_Shell" title="WikiPedia">Wikipedia - Secure Shell</a> for more general information and <a class="interwiki" href="https://packages.debian.org/ssh" title="DebPkg">ssh</a>, <a class="interwiki" href="https://packages.debian.org/lsh-client" title="DebPkg">lsh-client</a> or <a class="interwiki" href="https://packages.debian.org/dropbear" title="DebPkg">dropbear</a> for the SSH software implementations out of which <a class="https" href="https://www.openssh.com/">OpenSSH</a> is the most popular and most widely used<sup><a href="#fnref-e22c581d3d1d0688c833f4f4c96cac1cf62b715d" id="fndef-e22c581d3d1d0688c833f4f4c96cac1cf62b715d-1">2</a></sup>. <span class="anchor" id="line-18"></span>SSH replaces the unencrypted <a class="interwiki" href="https://en.wikipedia.org/wiki/Telnet" title="WikiPedia">telnet</a>,<a class="interwiki" href="https://en.wikipedia.org/wiki/Rlogin" title="WikiPedia">rlogin</a> and <a class="interwiki" href="https://en.wikipedia.org/wiki/Remote_shell" title="WikiPedia">rsh</a> and adds many features. <span class="anchor" id="line-19"></span><span class="anchor" id="line-20"></span><p class="line874">In this document we'll be using the OpenSSH command suite, it will also be assumed that the following two variables are defined: <span class="anchor" id="line-21"></span><span class="anchor" id="line-22"></span><p class="line867"><span class="anchor" id="line-23"></span><span class="anchor" id="line-24"></span><span class="anchor" id="line-25"></span><pre><span class="anchor" id="line-1-1"></span>remote_host=&lt;the remote computer&gt; <span class="anchor" id="line-2-1"></span>remote_user=&lt;your user name on $remote_host&gt;</pre><span class="anchor" id="line-26"></span><span class="anchor" id="line-27"></span><p class="line874">So, if you want to use the recipes below, first set these variables to the remote computer name and the user name on that remote computer. Then cut and paste of the commands below should work. remote_host may also be an IP-address. <span class="anchor" id="line-28"></span><span class="anchor" id="line-29"></span><p class="line867"> <h2 id="Installation">Installation</h2> <span class="anchor" id="line-30"></span><span class="anchor" id="line-31"></span><p class="line867"> <h3 id="Installation_of_the_client">Installation of the client</h3> <span class="anchor" id="line-32"></span><span class="anchor" id="line-33"></span><p class="line874">Normally the client is installed by default. If not it suffices to run as root: <span class="anchor" id="line-34"></span><span class="anchor" id="line-35"></span><p class="line867"><span class="anchor" id="line-36"></span><span class="anchor" id="line-37"></span><pre><span class="anchor" id="line-1-2"></span>apt install openssh-client</pre><span class="anchor" id="line-38"></span><span class="anchor" id="line-39"></span><p class="line867"> <h3 id="Installation_of_the_server">Installation of the server</h3> <span class="anchor" id="line-40"></span><span class="anchor" id="line-41"></span><p class="line874">The server allows to connect remotely and gets installed by running as root: <span class="anchor" id="line-42"></span><span class="anchor" id="line-43"></span><p class="line867"><span class="anchor" id="line-44"></span><span class="anchor" id="line-45"></span><pre><span class="anchor" id="line-1-3"></span>apt install openssh-server</pre><span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><p class="line867"> <h2 id="Configuration_files">Configuration files</h2> <span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span><p class="line862">The main configuration files are in the directory <em>/etc/ssh</em> : <span class="anchor" id="line-50"></span><span class="anchor" id="line-51"></span><ul><li><p class="line891"><strong>ssh_config</strong> : client configuration file <span class="anchor" id="line-52"></span></li><li><p class="line891"><strong>sshd_config</strong> : server configuration file <span class="anchor" id="line-53"></span><span class="anchor" id="line-54"></span></li></ul><p class="line874">Starting with Bullseye, configuration files will also be read from the following subfolders : <span class="anchor" id="line-55"></span><span class="anchor" id="line-56"></span><ul><li><p class="line891"><strong>/etc/ssh/ssh_config.d/*.conf</strong> : client configuration file <span class="anchor" id="line-57"></span></li><li><p class="line891"><strong>/etc/ssh/sshd_config.d/*.conf</strong> : server configuration file <span class="anchor" id="line-58"></span><span class="anchor" id="line-59"></span></li></ul><p class="line862">These have been enabled with the <strong>Include</strong> parameter in ssh_config and sshd_config. Making changes locally using these directories can ease configuration management, and avoid issues with upgrades that make changes to package managed configuration files. <span class="anchor" id="line-60"></span><span class="anchor" id="line-61"></span><p class="line862">In addition the <em>/etc/ssh</em> directory contains the private/public key pairs <span class="anchor" id="line-62"></span>identifying your host : <span class="anchor" id="line-63"></span><span class="anchor" id="line-64"></span><ul><li>ssh_host_dsa_key <span class="anchor" id="line-65"></span></li><li>ssh_host_dsa_key.pub <span class="anchor" id="line-66"></span></li><li>ssh_host_rsa_key <span class="anchor" id="line-67"></span></li><li>ssh_host_rsa_key.pub <span class="anchor" id="line-68"></span><span class="anchor" id="line-69"></span></li></ul><p class="line862">Since OpenSSH 5.7<sup><a href="#fnref-1b2604300e2bae33087c1965b50e2af382e1febf" id="fndef-1b2604300e2bae33087c1965b50e2af382e1febf-2">3</a></sup>, a new private/public key pair is available: <span class="anchor" id="line-70"></span><span class="anchor" id="line-71"></span><ul><li>ssh_host_ecdsa_key <span class="anchor" id="line-72"></span></li><li>ssh_host_ecdsa_key.pub <span class="anchor" id="line-73"></span><span class="anchor" id="line-74"></span></li></ul><p class="line862">Since OpenSSH 6.5<sup><a href="#fnref-fe3f706215a8e77b637c23403ae7efbd968ff825" id="fndef-fe3f706215a8e77b637c23403ae7efbd968ff825-3">4</a></sup>, a new private/public key pair is available: <span class="anchor" id="line-75"></span><span class="anchor" id="line-76"></span><ul><li>ssh_host_ed25519_key <span class="anchor" id="line-77"></span></li><li>ssh_host_ed25519_key.pub <span class="anchor" id="line-78"></span><span class="anchor" id="line-79"></span></li></ul><p class="line867"> <h3 id="Regenerating_host_keys">Regenerating host keys</h3> <span class="anchor" id="line-80"></span><span class="anchor" id="line-81"></span><p class="line867"><span class="anchor" id="line-82"></span><span class="anchor" id="line-83"></span><span class="anchor" id="line-84"></span><pre><span class="anchor" id="line-1-4"></span>rm /etc/ssh/ssh_host_* <span class="anchor" id="line-2-2"></span>dpkg-reconfigure openssh-server</pre><span class="anchor" id="line-85"></span><span class="anchor" id="line-86"></span><p class="line867"> <h2 id="Remote_login">Remote login</h2> <span class="anchor" id="line-87"></span><span class="anchor" id="line-88"></span><p class="line867"> <h3 id="With_password">With password</h3> <span class="anchor" id="line-89"></span><span class="anchor" id="line-90"></span><p class="line874">If you want to login to $remote_host as user $remote_user simply type <span class="anchor" id="line-91"></span><span class="anchor" id="line-92"></span><p class="line867"><span class="anchor" id="line-93"></span><span class="anchor" id="line-94"></span><pre><span class="anchor" id="line-1-5"></span>ssh $remote_user@$remote_host</pre><span class="anchor" id="line-95"></span><span class="anchor" id="line-96"></span><p class="line874">and then type in your password. <span class="anchor" id="line-97"></span><span class="anchor" id="line-98"></span><p class="line874">If the usernames on the local and the remote computer are identical, you can drop the $remote_user@-part and simply write <span class="anchor" id="line-99"></span><span class="anchor" id="line-100"></span><p class="line867"><span class="anchor" id="line-101"></span><span class="anchor" id="line-102"></span><pre><span class="anchor" id="line-1-6"></span>ssh $remote_host</pre><span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><p class="line874">If this is the first time you login to the remote computer, ssh will ask you whether you are sure you want to connect to the remote computer. Answer 'yes' after you verified the remote computer's fingerprint, type in your password, and ssh will connect you to the remote host. <span class="anchor" id="line-105"></span><span class="anchor" id="line-106"></span><p class="line867"> <h3 id="Using_shared_keys">Using shared keys</h3> <span class="anchor" id="line-107"></span><span class="anchor" id="line-108"></span><p class="line862">One of the functions of ssh is using a pair of private/public keys to connect to a remote host. Also known as <em><strong>SSH keys</strong></em>. This method allows you to login to a remote host without typing your password every time. To do this you must generate a pair of private/public keys on your local machine and deposit the public key on the remote host. <span class="anchor" id="line-109"></span><span class="anchor" id="line-110"></span><p class="line874">To generate the key, use the program ssh-keygen as follows <span class="anchor" id="line-111"></span><span class="anchor" id="line-112"></span><p class="line867"><span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span><pre><span class="anchor" id="line-1-7"></span>ssh-keygen -t rsa</pre><span class="anchor" id="line-115"></span><span class="anchor" id="line-116"></span><p class="line874">This program generates a pair of private/public keys in the directory ~/.ssh. The program first asks for the destination files for the keys, by default located in ~/.ssh. Afterwards a passphrase is requested. <span class="anchor" id="line-117"></span><span class="anchor" id="line-118"></span><p class="line874">Note: We recommend not to leave the passphrase empty. An attacker who gets hold of your private key can otherwise connect to the hosts where you deposited you public key since the passphrase is empty. Choose a long and complex passphrase. <span class="anchor" id="line-119"></span><span class="anchor" id="line-120"></span><p class="line874">Your private key is id_rsa (don't give it to someone else), your public key is id_rsa.pub. <span class="anchor" id="line-121"></span><span class="anchor" id="line-122"></span><p class="line862">You copy your public key to a remote host with the command <strong>ssh-copy-id</strong> <span class="anchor" id="line-123"></span><span class="anchor" id="line-124"></span><p class="line867"><span class="anchor" id="line-125"></span><span class="anchor" id="line-126"></span><pre><span class="anchor" id="line-1-8"></span>ssh-copy-id -i ~/.ssh/id_rsa.pub $remote_user@$remote_host</pre><span class="anchor" id="line-127"></span><span class="anchor" id="line-128"></span><p class="line874">Now you can connect simply to the remote host and the passphase is asked for. Once done, you get connected to the remote host. In case of a new connection the passphrase does not get asked for again during your entire session. <span class="anchor" id="line-129"></span><span class="anchor" id="line-130"></span><p class="line867"> <h2 id="Keys_management">Keys management</h2> <span class="anchor" id="line-131"></span><span class="anchor" id="line-132"></span><p class="line867"> <h3 id="Using_GUI">Using GUI</h3> <span class="anchor" id="line-133"></span><span class="anchor" id="line-134"></span><p class="line862">Optionally, <a class="interwiki" href="https://packages.debian.org/seahorse" title="DebPkg">seahorse</a> is a GNOME application which easily manage encryption keys and passwords through an intuitive Graphical User Interface (GUI). Seahorse is able to do various operations. Such as create SSH or PGP keys, configure them, and cache them. <a href="/Seahorse">Read more</a>. <span class="anchor" id="line-135"></span><span class="anchor" id="line-136"></span><p class="line867"> <h2 id="Securing">Securing</h2> <span class="anchor" id="line-137"></span><span class="anchor" id="line-138"></span><p class="line867"> <h3 id="SSH_Server">SSH Server</h3> <span class="anchor" id="line-139"></span><span class="anchor" id="line-140"></span><p class="line862">By default a SSH server is relatively secure. With the help of some good practices, configuration options, and external utilities it is possible to make it even harder for 'robots' and <em>crackers</em> <span class="anchor" id="line-141"></span><span class="anchor" id="line-142"></span><p class="line867"> <h4 id="Good_practices_with_SSH_Server">Good practices with SSH Server</h4> <span class="anchor" id="line-143"></span><span class="anchor" id="line-144"></span><ul><li><p class="line891"><img alt="/!\" height="16" src="/htdocs/debwiki/img/alert.png" title="/!\" width="16" /> Apply <a class="interwiki" href="https://packages.debian.org/openssh-server" title="DebPkg">openssh-server</a> security updates as soon as possible. Which allows to protect against known security holes. <span class="anchor" id="line-145"></span></li><li><p class="line891"><a href="/SSH#Configuration_Options">Activate SSH keys authentication</a> only with passwords/passphrases. Deactivate password only authentication. <span class="anchor" id="line-146"></span></li><li><p class="line862">Consider using <a class="interwiki" href="https://packages.debian.org/fail2ban" title="DebPkg">fail2ban</a> which is a log file monitor that automatically bans an IP address after a predefined number of failed login attempts. Which automatically guards against <a class="https" href="https://en.wikipedia.org/wiki/Brute-force_attack">brute-force attacks</a>. <span class="anchor" id="line-147"></span></li><li><p class="line862">More good practices for using ssh at <a class="https" href="https://lackof.org/taggart/hacking/ssh/">https://lackof.org/taggart/hacking/ssh/</a> <span class="anchor" id="line-148"></span></li><li><p class="line862">Mozilla's recommendations on configuring SSH servers and clients at <a class="https" href="https://infosec.mozilla.org/guidelines/openssh.html">https://infosec.mozilla.org/guidelines/openssh.html</a> <span class="anchor" id="line-149"></span><span class="anchor" id="line-150"></span></li></ul><p class="line867"> <h4 id="Configuration_Options">Configuration Options</h4> <span class="anchor" id="line-151"></span><span class="anchor" id="line-152"></span><p class="line867"><img alt="(!)" height="16" src="/htdocs/debwiki/img/idea.png" title="(!)" width="16" /> One should edit the file /etc/ssh/sshd_config to change the parameters and then restart the ssh server with <span class="anchor" id="line-153"></span><span class="anchor" id="line-154"></span><p class="line867"><span class="anchor" id="line-155"></span><span class="anchor" id="line-156"></span><pre><span class="anchor" id="line-1-9"></span>service ssh restart</pre><span class="anchor" id="line-157"></span><span class="anchor" id="line-158"></span><ul><li><p class="line862">Deactivate using passwords for authentication (<em>PasswordAuthentication no</em>). <span class="anchor" id="line-159"></span></li><li><p class="line862">Deactivate using the root account (<em>PermitRootLogin no</em>). <span class="anchor" id="line-160"></span></li><li><p class="line862">Only allow login by certain users or groups (<em>AllowUsers</em> and <em>AllowGroups</em>) <span class="anchor" id="line-161"></span><span class="anchor" id="line-162"></span></li></ul><p class="line867"><img alt="{i}" height="16" src="/htdocs/debwiki/img/icon-info.png" title="{i}" width="16" /> The options <em>AllowUsers</em> and <em>AllowGroups</em> do not improve the security of a SSH server. But in certain cases their use allows to resist a <em>brute force</em> attack a little longer. <span class="anchor" id="line-163"></span><span class="anchor" id="line-164"></span><p class="line874">You can list your current sshd settings with the following command: <span class="anchor" id="line-165"></span><span class="anchor" id="line-166"></span><p class="line867"><span class="anchor" id="line-167"></span><span class="anchor" id="line-168"></span><pre><span class="anchor" id="line-1-10"></span>sshd -T | sort</pre><span class="anchor" id="line-169"></span><span class="anchor" id="line-170"></span><p class="line867"> <h4 id="External_Utilities">External Utilities</h4> <span class="anchor" id="line-171"></span><span class="anchor" id="line-172"></span><ul><li><p class="line891"><a class="interwiki" href="https://packages.debian.org/fail2ban" title="DebianPkg">fail2ban</a> : allows to automatically blacklist IPs attempting to <em>brute force</em> a SSH server with the help of <a class="interwiki" href="https://packages.debian.org/iptables" title="DebianPkg">iptables</a>. <span class="anchor" id="line-173"></span></li><li><p class="line891"><a class="interwiki" href="https://packages.debian.org/denyhosts" title="DebianPkg">denyhosts</a> : as <a class="interwiki" href="https://packages.debian.org/fail2ban" title="DebianPkg">fail2ban</a>, <a class="interwiki" href="https://packages.debian.org/denyhosts" title="DebianPkg">denyhosts</a> allows to block IP addresses trying to brute force a connection to ssh. But in contrast to <a class="interwiki" href="https://packages.debian.org/fail2ban" title="DebPkg">fail2ban</a> it does not use <a class="interwiki" href="https://packages.debian.org/iptables" title="DebPkg">iptables</a>, but the file <em>/etc/hosts.deny</em>. <span class="anchor" id="line-174"></span><span class="anchor" id="line-175"></span></li></ul><p class="line867"> <h3 id="SSH_Client">SSH Client</h3> <span class="anchor" id="line-176"></span><span class="anchor" id="line-177"></span><p class="line867"> <h4 id="Good_practices_with_SSH_Client">Good practices with SSH Client</h4> <span class="anchor" id="line-178"></span><span class="anchor" id="line-179"></span><ul><li><p class="line891"><img alt="/!\" height="16" src="/htdocs/debwiki/img/alert.png" title="/!\" width="16" /> Apply <a class="interwiki" href="https://packages.debian.org/openssh-client" title="DebPkg">openssh-client</a> security updates as soon as possible. Which allows to protect against known security holes. <span class="anchor" id="line-180"></span></li><li><p class="line862">Use <a href="/SSH#Using_shared_keys">SSH keys</a> authentication. Rather than password authentication. <span class="anchor" id="line-181"></span></li><li><p class="line862">Add <a class="interwiki" href="https://en.wikipedia.org/wiki/Password_strength#Guidelines_for_strong_passwords" title="WikiPedia">strong passwords</a>/passphrases to your SSH keys. This reduce risk of <a class="interwiki" href="https://en.wikipedia.org/wiki/Brute-force_attack" title="WikiPedia">brute-force attacks</a>. <span class="anchor" id="line-182"></span><span class="anchor" id="line-183"></span></li></ul><p class="line867"> <h2 id="Additional_Functions">Additional Functions</h2> <span class="anchor" id="line-184"></span><span class="anchor" id="line-185"></span><p class="line867"> <h3 id="View_files_in_GUI">View files in GUI</h3> <span class="anchor" id="line-186"></span><span class="anchor" id="line-187"></span><p class="line874">In file managers like Konqueror, Dolphin, Krusader and Midnight Commander you can use FISH to view files in a GUI using: <span class="anchor" id="line-188"></span><span class="anchor" id="line-189"></span><p class="line867"><span class="anchor" id="line-190"></span><span class="anchor" id="line-191"></span><pre><span class="anchor" id="line-1-11"></span>fish://username@server_name_or_ip</pre><span class="anchor" id="line-192"></span><span class="anchor" id="line-193"></span><p class="line867"> <h2 id="Additional_Commands">Additional Commands</h2> <span class="anchor" id="line-194"></span><span class="anchor" id="line-195"></span><p class="line867"> <h3 id="scp">scp</h3> <span class="anchor" id="line-196"></span><span class="anchor" id="line-197"></span><p class="line867"><em>scp</em> is a command line utility allowing to transfer files between two machines. <span class="anchor" id="line-198"></span><span class="anchor" id="line-199"></span><ul><li>Sending a file: <span class="anchor" id="line-200"></span></li></ul><p class="line867"><span class="anchor" id="line-201"></span><span class="anchor" id="line-202"></span><pre><span class="anchor" id="line-1-12"></span>scp $source_file $remote_user@$remote_host:$destination_file</pre><span class="anchor" id="line-203"></span><ul><li>Copying a file to the local machine: <span class="anchor" id="line-204"></span></li></ul><p class="line867"><span class="anchor" id="line-205"></span><span class="anchor" id="line-206"></span><pre><span class="anchor" id="line-1-13"></span>scp $remote_user@$remote_host:$source_file $destination_file</pre><span class="anchor" id="line-207"></span><span class="anchor" id="line-208"></span><p class="line867"> <h3 id="sftp">sftp</h3> <span class="anchor" id="line-209"></span><p class="line874">[empty for now] <span class="anchor" id="line-210"></span><span class="anchor" id="line-211"></span><p class="line867"> <h4 id="text_mode">text mode</h4> <span class="anchor" id="line-212"></span><p class="line874">[empty for now] <span class="anchor" id="line-213"></span><span class="anchor" id="line-214"></span><p class="line867"> <h4 id="graphical_mode">graphical mode</h4> <span class="anchor" id="line-215"></span><p class="line874">[empty for now] <span class="anchor" id="line-216"></span><span class="anchor" id="line-217"></span><p class="line867"> <h3 id="clusterssh">clusterssh</h3> <span class="anchor" id="line-218"></span><p class="line874">[empty for now] <span class="anchor" id="line-219"></span><span class="anchor" id="line-220"></span><p class="line867"> <h3 id="ssh-agent_and_ssh-add">ssh-agent and ssh-add</h3> <span class="anchor" id="line-221"></span><span class="anchor" id="line-222"></span><p class="line867"><em>ssh-agent</em> is a useful utility to manage private keys and their passphrases. Most desktop environments in Debian will already be setup to run ssh-agent (through systemd user services or /etc/X11/Xsession), so you shouldn't need to start it manually. <span class="anchor" id="line-223"></span><span class="anchor" id="line-224"></span><p class="line867"><span class="anchor" id="line-225"></span><span class="anchor" id="line-226"></span><span class="anchor" id="line-227"></span><pre><span class="anchor" id="line-1-14"></span># Check if ssh-agent is running <span class="anchor" id="line-2-3"></span>env | grep -i ssh</pre><span class="anchor" id="line-228"></span><span class="anchor" id="line-229"></span><p class="line874">You will still need to tell the agent to manage your keys. <span class="anchor" id="line-230"></span><span class="anchor" id="line-231"></span><p class="line867"><span class="anchor" id="line-232"></span><span class="anchor" id="line-233"></span><span class="anchor" id="line-234"></span><span class="anchor" id="line-235"></span><span class="anchor" id="line-236"></span><pre><span class="anchor" id="line-1-15"></span># List keys managed by the agent <span class="anchor" id="line-2-4"></span>ssh-add -l <span class="anchor" id="line-3-1"></span># Add your ssh key <span class="anchor" id="line-4-1"></span>ssh-add ~/.ssh/your_private_key</pre><span class="anchor" id="line-237"></span><span class="anchor" id="line-238"></span><p class="line874">When a private key is first needed, you are prompted for its passphrase. ssh-agent will then remember the key so that your passphrase doesn't get asked anymore. <span class="anchor" id="line-239"></span><span class="anchor" id="line-240"></span><p class="line867"> <h3 id="keychain">keychain</h3> <span class="anchor" id="line-241"></span><span class="anchor" id="line-242"></span><p class="line867"><a class="https" href="https://www.funtoo.org/Keychain">Keychain</a>, provided by the package <a class="interwiki" href="https://packages.debian.org/keychain" title="DebPkg">keychain</a>, is a shell script allowing to use the ssh agent in multiple sessions of the same computer. In effect after the first start ssh-agent creates a permanent socket allowing the communication with ssh. This socket is referenced only in the environment of the session in which the agent was started. Keychain allows to detect the agent and propagate the access to this agent to other sessions; this allows to use a single instance of ssh-agent per user on a machine. <span class="anchor" id="line-243"></span><span class="anchor" id="line-244"></span><p class="line867"> <h3 id="ssh-askpass">ssh-askpass</h3> <span class="anchor" id="line-245"></span><span class="anchor" id="line-246"></span><p class="line867"><em><a class="interwiki" href="https://packages.debian.org/ssh-askpass" title="DebPkg">ssh-askpass</a></em> is an utility to simply the question for the password of a private key when using it. Several implementations exist: <span class="anchor" id="line-247"></span><span class="anchor" id="line-248"></span><ul><li><p class="line891"><strong>x11-ssh-askpass</strong> : version for X11 <span class="anchor" id="line-249"></span></li><li><p class="line891"><strong>kaskpass</strong> : integration of ssh-askpass into the KDE environment <span class="anchor" id="line-250"></span></li><li><p class="line891"><strong>ssh-askpass-gnome</strong> : integration of ssh-askpass into the Gnome environment <span class="anchor" id="line-251"></span><span class="anchor" id="line-252"></span></li></ul><p class="line867"> <h3 id="libpam-usb">libpam-usb</h3> <span class="anchor" id="line-253"></span><span class="anchor" id="line-254"></span><p class="line867"><em><a class="interwiki" href="https://packages.debian.org/libpam-usb" title="DebianPkg">libpam-usb</a></em> is an utility (only available up to Debian Jessie) allowing authentication with an USB stick. This package includes a useful utilty : <em>pamusb-agent</em>. This utility, once correctly configured, allows to load the SSH keys present on the USB stick once it is connected and to unload them when it is disconnected. <span class="anchor" id="line-255"></span><span class="anchor" id="line-256"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-257"></span><span class="anchor" id="line-258"></span><p class="line867"> <h2 id="Remote_commands">Remote commands</h2> <span class="anchor" id="line-259"></span><span class="anchor" id="line-260"></span><p class="line874">If you just want to run one command on the remote computer, you don't need to login. You can tell ssh to run the command without login, for instance, <span class="anchor" id="line-261"></span><span class="anchor" id="line-262"></span><p class="line867"><span class="anchor" id="line-263"></span><span class="anchor" id="line-264"></span><pre><span class="anchor" id="line-1-16"></span>ssh $remote_user@$remote_host 'ls *.txt'</pre><span class="anchor" id="line-265"></span><p class="line874">lists all files with extension .txt on the remote computer. This works with single tick quotes '...' as shown here, with double tick quotes &quot;...&quot;, and without quotes. There may be differences between these three cases, though, not yet documented here. <span class="anchor" id="line-266"></span><span class="anchor" id="line-267"></span><p class="line867"> <h2 id="SSH_into_Debian_from_another_OS">SSH into Debian from another OS</h2> <span class="anchor" id="line-268"></span><span class="anchor" id="line-269"></span><ul><li><p class="line891"><a class="https" href="https://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a> is a <a href="/TerminalEmulator">terminal emulator</a> application which can act as a client for ssh. It's widely used by Windows users. <span class="anchor" id="line-270"></span></li><li><p class="line862">Wikipedia has <a class="interwiki" href="https://en.wikipedia.org/wiki/Comparison_of_SSH_clients" title="WikiPedia">Comparison_of_SSH_clients</a> <span class="anchor" id="line-271"></span><span class="anchor" id="line-272"></span></li></ul><p class="line867"> <h2 id="Good_practices_of_SSH_usage">Good practices of SSH usage</h2> <span class="anchor" id="line-273"></span><span class="anchor" id="line-274"></span><p class="line862">You <strong>must</strong> read this: <a class="https" href="https://lackof.org/taggart/hacking/ssh/">https://lackof.org/taggart/hacking/ssh/</a> <span class="anchor" id="line-275"></span><span class="anchor" id="line-276"></span><p class="line874">This document sums up many good practices that regular SSH users should follow in order to avoid compromising the security of their accounts (and of the whole machine at the same time). <span class="anchor" id="line-277"></span><span class="anchor" id="line-278"></span><p class="line862">Configure your <tt>~/.ssh/config</tt> to send only the right key. <span class="anchor" id="line-279"></span><span class="anchor" id="line-280"></span><p class="line867"><span class="anchor" id="line-281"></span><span class="anchor" id="line-282"></span><span class="anchor" id="line-283"></span><span class="anchor" id="line-284"></span><span class="anchor" id="line-285"></span><pre><span class="anchor" id="line-1-17"></span>Host master.debian.org <span class="anchor" id="line-2-5"></span> User account <span class="anchor" id="line-3-2"></span> IdentityFile ~/.ssh/id_rsa <span class="anchor" id="line-4-2"></span> IdentitiesOnly yes</pre><span class="anchor" id="line-286"></span><span class="anchor" id="line-287"></span><span class="anchor" id="line-288"></span><p class="line867"> <h2 id="Troubleshooting">Troubleshooting</h2> <span class="anchor" id="line-289"></span><span class="anchor" id="line-290"></span><p class="line867"> <h3 id="OpenSSL_version_mismatch._Built_against_1000105f.2C_you_have_10001060">OpenSSL version mismatch. Built against 1000105f, you have 10001060</h3> <span class="anchor" id="line-291"></span><span class="anchor" id="line-292"></span><p class="line862">If you get an error message like this when starting the <tt class="backtick">ssh</tt> daemon, you need to run: <span class="anchor" id="line-293"></span><span class="anchor" id="line-294"></span><p class="line867"><span class="anchor" id="line-295"></span><span class="anchor" id="line-296"></span><pre><span class="anchor" id="line-1-18"></span>apt install openssh-server openssh-client</pre><span class="anchor" id="line-297"></span><span class="anchor" id="line-298"></span><p class="line862">Also see <a class="interwiki" href="https://bugs.debian.org/732940" title="DebianBug">bug #732940</a>. <span class="anchor" id="line-299"></span><span class="anchor" id="line-300"></span><p class="line867"> <h3 id="SSH_hangs">SSH hangs</h3> <span class="anchor" id="line-301"></span><span class="anchor" id="line-302"></span><p class="line867"><strong>Issue</strong> <span class="anchor" id="line-303"></span><span class="anchor" id="line-304"></span><p class="line862">You are trying to SSH into a remote computer. But during SSH log-in the session hangs/freezes indefinitely. Thus you are not presented with the command prompt. And you are not able to use any SSH commands <img alt=":(" height="16" src="/htdocs/debwiki/img/sad.png" title=":(" width="16" /> <span class="anchor" id="line-305"></span>When using SSH debug mode the session hangs at this line <em><strong><tt>debug2:&nbsp;channel&nbsp;0:&nbsp;open&nbsp;confirm&nbsp;rwindow&nbsp;0&nbsp;rmax&nbsp;32768</tt></strong></em> <span class="anchor" id="line-306"></span><span class="anchor" id="line-307"></span><p class="line867"><strong>Possible cause</strong> <span class="anchor" id="line-308"></span><span class="anchor" id="line-309"></span><p class="line874">With some routers behind NAT and when using OpenSSH. During session setup, after the password has been given, OpenSSH sets the TOS (type of service) field in the IP datagram. The router choke on this. The effect is that your SSH session hangs indefinitely. In other words, SSH commands or connections are seldom working or not working at all. <span class="anchor" id="line-310"></span><span class="anchor" id="line-311"></span><p class="line867"> <h4 id="Resolution_with_IPQoS_0x00">Resolution with IPQoS 0x00</h4> <span class="anchor" id="line-312"></span><span class="anchor" id="line-313"></span><p class="line874">Until your router manufacturer fix their firmware. Here is one option to resolve that issue: <span class="anchor" id="line-314"></span><span class="anchor" id="line-315"></span><ol type="1"><li><p class="line862">Double check your <a class="interwiki" href="https://packages.debian.org/openssh-server" title="DebPkg">openssh-server</a> and <a class="interwiki" href="https://packages.debian.org/openssh-client" title="DebPkg">openssh-client</a> version are 5.7 or more recent. For example the resolution below should work with Debian 7.11 Wheezy or more recent as it comes with OpenSSH version 6.0. <span class="anchor" id="line-316"></span></li><li><p class="line862">Edit one of the following two files located at: <span class="anchor" id="line-317"></span><span class="anchor" id="line-318"></span><pre><span class="anchor" id="line-1-19"></span>~/.ssh/config</pre><p class="line862"> or <span class="anchor" id="line-319"></span><span class="anchor" id="line-320"></span><pre><span class="anchor" id="line-1-20"></span>/etc/ssh/ssh_config</pre><p class="line862"> Note: <em><strong><tt>config</tt></em></strong> file is per user and <em><strong><tt>ssh_config</tt></em></strong> file is for all users and system wide. If unsure edit the appropriate user <em><strong><tt>config</tt></strong></em> file.<span class="anchor" id="line-321"></span><span class="anchor" id="line-322"></span><p class="line862">File content before <span class="anchor" id="line-323"></span><span class="anchor" id="line-324"></span><pre><span class="anchor" id="line-1-21"></span>Host *</pre><span class="anchor" id="line-325"></span><p class="line862">File content after <span class="anchor" id="line-326"></span><span class="anchor" id="line-327"></span><span class="anchor" id="line-328"></span><pre><span class="anchor" id="line-1-22"></span>Host * <span class="anchor" id="line-2-6"></span> IPQoS 0x00</pre><span class="anchor" id="line-329"></span></li><li>If you have any Terminal/Console window(s) already open. Fully close all of them. Doing so will close any active SSH sessions. <span class="anchor" id="line-330"></span></li><li><p class="line862">No need to restart OpenSSH or your Debian. Try again to SSH into any remote server. It should work. Done you have successfully fixed that issue <img alt=":)" height="16" src="/htdocs/debwiki/img/smile.png" title=":)" width="16" /> <span class="anchor" id="line-331"></span><span class="anchor" id="line-332"></span><p class="line862">Thanks to Joe and catmaker for this tip <img alt=":)" height="16" src="/htdocs/debwiki/img/smile.png" title=":)" width="16" /> <span class="anchor" id="line-333"></span><span class="anchor" id="line-334"></span><p class="line862">Related documentation at <a class="https" href="https://www.openssh.com/txt/release-5.7">https://www.openssh.com/txt/release-5.7</a> <span class="anchor" id="line-335"></span><span class="anchor" id="line-336"></span></li></ol><p class="line867"> <h4 id="Resolution_with_netcat">Resolution with netcat</h4> <span class="anchor" id="line-337"></span><span class="anchor" id="line-338"></span><p class="line867"><img alt="/!\" height="16" src="/htdocs/debwiki/img/alert.png" title="/!\" width="16" /> <strong>WARNING:</strong> It is suggested to consider using <a href="/SSH#Resolution_with_IPQoS_0x00">that other resolution with IPQoS 0x00</a> instead of using netcat/<em><strong><tt>ProxyCommand&nbsp;nc&nbsp;%h&nbsp;%p</tt></em></strong> option. Because <em><strong><tt>IPQoS&nbsp;0x00</tt></em></strong> is the official built-in OpenSSH option. Also <em><strong><tt>IPQoS&nbsp;0x00</tt></em></strong> is a more direct way to resolve that issue, and potentially more secure option. Because <em><strong><tt>IPQoS&nbsp;0x00</tt></strong></em> uses SSH's built in encryption for secure transfers. Compare to netcat's <em>not</em> encrypted transfers. Sources: <a class="https" href="https://nc110.sourceforge.io/">1</a> <a class="https" href="https://www.ndchost.com/wiki/server-administration/netcat-over-ssh#using-dd-over-netcat">2</a>. If you choose to use netcat/<em><strong><tt>ProxyCommand&nbsp;nc&nbsp;%h&nbsp;%p</tt></strong></em> option read on. <span class="anchor" id="line-339"></span><span class="anchor" id="line-340"></span><p class="line862">Another option to resolve that SSH hangs issue is to use <em><strong><tt>ProxyCommand&nbsp;nc&nbsp;%h&nbsp;%p</tt></em></strong>. To do so follow the same steps as <a href="/SSH#Resolution_with_IPQoS_0x00">that above resolution with IPQoS 0x00</a>. But replace <em><strong><tt>IPQoS&nbsp;0x00</tt></strong></em> with<span class="anchor" id="line-341"></span><span class="anchor" id="line-342"></span><pre><span class="anchor" id="line-1-23"></span>ProxyCommand nc %h %p</pre><span class="anchor" id="line-343"></span><span class="anchor" id="line-344"></span><p class="line867"> <h3 id="Keep_SSH_connection_alive">Keep SSH connection alive</h3> <span class="anchor" id="line-345"></span><span class="anchor" id="line-346"></span><p class="line874">For security reason, by default a SSH connection is automatically closed after a set period of time. But in some cases you want to keep that connection open. Such as cloud storage over SSH connection. <span class="anchor" id="line-347"></span><span class="anchor" id="line-348"></span><p class="line867"><img alt="/!\" height="16" src="/htdocs/debwiki/img/alert.png" title="/!\" width="16" /> <strong>WARNING:</strong> Before activating that keep SSH connection alive option. It is suggested to consider <a href="/SSH#Securing">securing</a> both your SSH Client and SSH Server. Because for example, there is a risk that if your users leave their SSH session open, and their computer unattended and unlocked. Anyone can approach that computer, then exploit that open SSH connection. For example by using the <tt>passwd</tt> command, and change the password. And thus gain access to the server. In other words, before activating that keep SSH connection alive option, it is suggested to use your best judgment and good security practices. <span class="anchor" id="line-349"></span><span class="anchor" id="line-350"></span><p class="line867"> <h4 id="For_Debian_7.x_server">For Debian 7.x server</h4> <span class="anchor" id="line-351"></span><span class="anchor" id="line-352"></span><p class="line874">Steps to keep SSH connection alive. <span class="anchor" id="line-353"></span><span class="anchor" id="line-354"></span><p class="line862">On the SSH server edit <tt>/etc/ssh/sshd_config</tt> file and add the following at the bottom of that file. <span class="anchor" id="line-355"></span><span class="anchor" id="line-356"></span><p class="line867"><span class="anchor" id="line-357"></span><span class="anchor" id="line-358"></span><span class="anchor" id="line-359"></span><span class="anchor" id="line-360"></span><span class="anchor" id="line-361"></span><span class="anchor" id="line-362"></span><pre><span class="anchor" id="line-1-24"></span># Keep client SSH connection alive by sending every 300 seconds a small keep-alive packet to the server in order to use ssh connection. 300 seconds equal 5 minutes. <span class="anchor" id="line-2-7"></span>ClientAliveInterval 300 <span class="anchor" id="line-3-3"></span> <span class="anchor" id="line-4-3"></span># Disconnect client after 3333 &quot;ClientAlive&quot; requests. Format is (ClientAliveInterval x ClientAliveCountMax). In this example (300 seconds x 3333) = ~999,900 seconds = ~16,665 minutes = ~277 hours = ~11 days. <span class="anchor" id="line-5-1"></span>ClientAliveCountMax 3333</pre><span class="anchor" id="line-363"></span><span class="anchor" id="line-364"></span><p class="line862">As <tt>root</tt> user restart the SSH service: <span class="anchor" id="line-365"></span><span class="anchor" id="line-366"></span><p class="line867"><span class="anchor" id="line-367"></span><span class="anchor" id="line-368"></span><pre><span class="anchor" id="line-1-25"></span>service sshd restart</pre><span class="anchor" id="line-369"></span><span class="anchor" id="line-370"></span><p class="line874">Please note that on recent Debian systems (e.g. Wheezy 7 with current updates as of Nov. 2015), the above command no longer works and returns the error: <span class="anchor" id="line-371"></span><span class="anchor" id="line-372"></span><p class="line867"><span class="anchor" id="line-373"></span><span class="anchor" id="line-374"></span><span class="anchor" id="line-375"></span><pre><span class="anchor" id="line-1-26"></span>sudo service sshd restart <span class="anchor" id="line-2-8"></span>sshd: unrecognized service</pre><span class="anchor" id="line-376"></span><span class="anchor" id="line-377"></span><p class="line874">However, the following works: <span class="anchor" id="line-378"></span><span class="anchor" id="line-379"></span><p class="line867"><span class="anchor" id="line-380"></span><span class="anchor" id="line-381"></span><span class="anchor" id="line-382"></span><pre><span class="anchor" id="line-1-27"></span>sudo service ssh restart <span class="anchor" id="line-2-9"></span>[ ok ] Restarting OpenBSD Secure Shell server: sshd.</pre><span class="anchor" id="line-383"></span><span class="anchor" id="line-384"></span><p class="line867"> <h2 id="See_also">See also</h2> <span class="anchor" id="line-385"></span><span class="anchor" id="line-386"></span><ul><li><p class="line891"><a class="interwiki" href="https://packages.debian.org/screen" title="DebianPkg">screen</a> - terminal multiplexer with VT100/ANSI terminal emulation <span class="anchor" id="line-387"></span></li><li><p class="line891"><a class="interwiki" href="https://packages.debian.org/tmux" title="DebianPkg">tmux</a> - alternative terminal multiplexer <span class="anchor" id="line-388"></span><span class="anchor" id="line-389"></span></li></ul><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-390"></span><a href="/CategoryNetwork">CategoryNetwork</a> <a href="/CategorySoftware">CategorySoftware</a> <a href="/CategorySystemAdministration">CategorySystemAdministration</a> <a href="/CategorySystemSecurity">CategorySystemSecurity</a> <span class="anchor" id="line-391"></span><div class="footnotes"><ol><li><p><a id="fnref-0b2e6c997d8b83e2b9fc0c2fba2896d27f6d74f8"></a><span class="anchor" id="line-1-28"></span><a class="https" href="https://tools.ietf.org/html/rfc4252">https://tools.ietf.org/html/rfc4252</a> (<a href="#fndef-0b2e6c997d8b83e2b9fc0c2fba2896d27f6d74f8-0">1</a>)</li><li><p><a id="fnref-e22c581d3d1d0688c833f4f4c96cac1cf62b715d"></a><span class="anchor" id="line-1-29"></span><a class="https" href="https://www.openssh.com/users.html">https://www.openssh.com/users.html</a> (<a href="#fndef-e22c581d3d1d0688c833f4f4c96cac1cf62b715d-1">2</a>)</li><li><p><a id="fnref-1b2604300e2bae33087c1965b50e2af382e1febf"></a><span class="anchor" id="line-1-30"></span><a class="https" href="https://www.openssh.com/txt/release-5.7">https://www.openssh.com/txt/release-5.7</a> (<a href="#fndef-1b2604300e2bae33087c1965b50e2af382e1febf-2">3</a>)</li><li><p><a id="fnref-fe3f706215a8e77b637c23403ae7efbd968ff825"></a><span class="anchor" id="line-1-31"></span><a class="https" href="https://www.openssh.com/txt/release-6.5">https://www.openssh.com/txt/release-6.5</a> (<a href="#fndef-fe3f706215a8e77b637c23403ae7efbd968ff825-3">4</a>)</li></ol></div><span class="anchor" id="bottom"></span></div><div id="pagebottom"></div> </div> <div id="footer"> <p id="pageinfo" class="info" lang="en" dir="ltr">SSH (<a class="nbinfo" href="/SSH?action=info" rel="nofollow">last modified 2023-11-09 23:33:12</a>)</p> <ul id="credits"> <li>Debian <a href="https://www.debian.org/legal/privacy">privacy policy</a>, Wiki <a href="/Teams/DebianWiki">team</a>, <a href="https://bugs.debian.org/wiki.debian.org">bugs</a> and <a href="https://salsa.debian.org/debian/wiki.debian.org">config</a>.</li><li>Powered by <a href="https://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin</a> and <a href="https://moinmo.in/Python" title="MoinMoin is written in Python.">Python</a>, with hosting provided by <a href="https://www.man-da.de/">Metropolitan Area Network Darmstadt</a>.</li> </ul> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10