<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wardterm</title>
    <description>The latest articles on DEV Community by Wardterm (@wardterm).</description>
    <link>https://dev.to/wardterm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4246039%2Fe74d6941-a47a-412e-8fab-4cf658264bbe.png</url>
      <title>DEV Community: Wardterm</title>
      <link>https://dev.to/wardterm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wardterm"/>
    <language>en</language>
    <item>
      <title>SSH config examples: 12 blocks ready to copy</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:26:56 +0000</pubDate>
      <link>https://dev.to/wardterm/ssh-config-examples-12-blocks-ready-to-copy-4m48</link>
      <guid>https://dev.to/wardterm/ssh-config-examples-12-blocks-ready-to-copy-4m48</guid>
      <description>&lt;h2&gt;
  
  
  The 12 SSH config examples on this page
&lt;/h2&gt;

&lt;p&gt;Each block below works as written: copy it into &lt;code&gt;~/.ssh/config&lt;/code&gt;, change the names and addresses, and connect. If the file does not exist yet, create it with the right permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir -p ~/.ssh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; chmod 700 ~/.ssh
touch ~/.ssh/config &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; chmod 600 ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;A short name for a server&lt;/li&gt;
&lt;li&gt;A key per server&lt;/li&gt;
&lt;li&gt;Many servers with one pattern&lt;/li&gt;
&lt;li&gt;Two GitHub accounts&lt;/li&gt;
&lt;li&gt;A jump host&lt;/li&gt;
&lt;li&gt;Saved tunnels&lt;/li&gt;
&lt;li&gt;Keepalive&lt;/li&gt;
&lt;li&gt;One connection reused&lt;/li&gt;
&lt;li&gt;Passphrases in the macOS Keychain&lt;/li&gt;
&lt;li&gt;tmux on every connection&lt;/li&gt;
&lt;li&gt;Old routers and switches&lt;/li&gt;
&lt;li&gt;Separate files with Include&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every block was checked with &lt;code&gt;ssh -G&lt;/code&gt; on OpenSSH 10. For how the file is read line by line, see &lt;a href="https://wardterm.com/guides/ssh-config-file/" rel="noopener noreferrer"&gt;the SSH config file guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH config examples for multiple hosts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. A short name for a server
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;web&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="mf"&gt;203.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;113.10&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;
    &lt;span class="nc"&gt;Port&lt;/span&gt; &lt;span class="mi"&gt;2222&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ssh web&lt;/code&gt; now replaces &lt;code&gt;ssh -p 2222 deploy@203.0.113.10&lt;/code&gt;. &lt;code&gt;Host&lt;/code&gt; is the name you type; &lt;code&gt;HostName&lt;/code&gt; is the real address.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. A key per server
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_db&lt;/span&gt;
    &lt;span class="nc"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;IdentitiesOnly yes&lt;/code&gt; stops SSH from trying every key in your agent first. With five or six keys loaded, servers start refusing you with &lt;code&gt;Too many authentication failures&lt;/code&gt; before they reach the right one.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Many servers with one pattern
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;app1&lt;/span&gt; &lt;span class="n"&gt;app2&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;

&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_prod&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;%h&lt;/code&gt; is the name you typed, so &lt;code&gt;ssh app1&lt;/code&gt; goes to &lt;code&gt;app1.internal.example.com&lt;/code&gt;. The second block covers every production host at once.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; reads your ~/.ssh/config, with keys, jump hosts and tunnels, and turns each Host into a server you open with a tap. Free to start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you use two GitHub accounts in SSH config?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4. Two GitHub accounts
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;git&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_personal&lt;/span&gt;
    &lt;span class="nc"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;

&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;work&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;git&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_work&lt;/span&gt;
    &lt;span class="nc"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Personal repositories keep their normal address. For work ones, swap the host in the clone URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github-work:company/api.git
ssh -T git@github-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second line asks GitHub which account the key belongs to. For an existing repository, change its remote with &lt;code&gt;git remote set-url origin git@github-work:company/api.git&lt;/code&gt;. The full setup, with the commit email per account, is in &lt;a href="https://wardterm.com/guides/multiple-github-accounts-ssh/" rel="noopener noreferrer"&gt;multiple GitHub accounts with SSH&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH config examples for jump hosts and tunnels
&lt;/h2&gt;

&lt;h3&gt;
  
  
  5. A jump host with ProxyJump
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;bastion&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;bastion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;jump&lt;/span&gt;

&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="mf"&gt;10.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;
    &lt;span class="nc"&gt;ProxyJump&lt;/span&gt; &lt;span class="n"&gt;bastion&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ssh 10.0.1.5&lt;/code&gt; now goes through the bastion on its own, and so do &lt;code&gt;scp&lt;/code&gt; and &lt;code&gt;rsync&lt;/code&gt;. Your keys stay on your computer, which is why ProxyJump is the safer choice compared with forwarding the agent. More in &lt;a href="https://wardterm.com/guides/proxyjump-jump-host/" rel="noopener noreferrer"&gt;ProxyJump and jump hosts&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Saved tunnels
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tunnel&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
    &lt;span class="nc"&gt;LocalForward&lt;/span&gt; &lt;span class="mi"&gt;5432&lt;/span&gt; &lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5432&lt;/span&gt;
    &lt;span class="nc"&gt;DynamicForward&lt;/span&gt; &lt;span class="mi"&gt;1080&lt;/span&gt;
    &lt;span class="nc"&gt;SessionType&lt;/span&gt; &lt;span class="n"&gt;none&lt;/span&gt;
    &lt;span class="nc"&gt;ExitOnForwardFailure&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ssh db-tunnel&lt;/code&gt; opens the database at &lt;code&gt;localhost:5432&lt;/code&gt; and a SOCKS proxy on port 1080, with no shell (&lt;code&gt;SessionType none&lt;/code&gt; is the same as &lt;code&gt;-N&lt;/code&gt;). &lt;code&gt;ExitOnForwardFailure&lt;/code&gt; makes SSH stop if a port is taken, instead of connecting without the tunnel.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you keep SSH connections alive and fast?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  7. Keepalive
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="nc"&gt;ServerAliveInterval&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="nc"&gt;ServerAliveCountMax&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Home routers and cloud firewalls drop connections that stay quiet for a few minutes. A small message every 30 seconds keeps them open, and after three without an answer SSH closes the session instead of freezing. If sessions still drop when your laptop sleeps, that is a job for tmux or Mosh, not the config.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. One connection reused
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;web&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;ControlMaster&lt;/span&gt; &lt;span class="n"&gt;auto&lt;/span&gt;
    &lt;span class="nc"&gt;ControlPath&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cm&lt;/span&gt;&lt;span class="o"&gt;-%&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;
    &lt;span class="nc"&gt;ControlPersist&lt;/span&gt; &lt;span class="mi"&gt;10m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first connection opens a socket; every &lt;code&gt;ssh&lt;/code&gt;, &lt;code&gt;scp&lt;/code&gt; or &lt;code&gt;git&lt;/code&gt; after it reuses it and starts at once. Name the hosts instead of using &lt;code&gt;Host *&lt;/code&gt;: two aliases for the same address and user, such as the two GitHub accounts above, would share one socket and one key. &lt;code&gt;ssh -O exit web&lt;/code&gt; closes it. See &lt;a href="https://wardterm.com/guides/ssh-multiplexing-controlmaster/" rel="noopener noreferrer"&gt;SSH multiplexing&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which SSH config examples help on a Mac?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  9. Passphrases in the macOS Keychain
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="nc"&gt;IgnoreUnknown&lt;/span&gt; &lt;span class="nc"&gt;UseKeychain&lt;/span&gt;
    &lt;span class="nc"&gt;AddKeysToAgent&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="nc"&gt;UseKeychain&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You type a key's passphrase once and macOS remembers it, even after a restart. &lt;code&gt;UseKeychain&lt;/code&gt; exists only in the ssh that comes with macOS, so &lt;code&gt;IgnoreUnknown&lt;/code&gt; keeps the same file working on Linux, where it would stop with &lt;code&gt;Bad configuration option&lt;/code&gt;. Details in &lt;a href="https://wardterm.com/guides/ssh-agent-macos-keychain/" rel="noopener noreferrer"&gt;ssh-agent and the macOS Keychain&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. tmux on every connection
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;dev&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;
    &lt;span class="nc"&gt;RequestTTY&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="nc"&gt;RemoteCommand&lt;/span&gt; &lt;span class="n"&gt;tmux&lt;/span&gt; &lt;span class="nb"&gt;new&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;A&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ssh dev&lt;/code&gt; lands in the tmux session called main, or creates it. When the connection drops, the next &lt;code&gt;ssh dev&lt;/code&gt; brings back the same windows. To open a plain shell once, run &lt;code&gt;ssh -o RemoteCommand=none dev&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which SSH config example works for old routers and switches?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  11. Old devices
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;1.2&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
    &lt;span class="nc"&gt;KexAlgorithms&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;diffie&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;hellman&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;group14&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;sha1&lt;/span&gt;
    &lt;span class="nc"&gt;HostKeyAlgorithms&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;rsa&lt;/span&gt;
    &lt;span class="nc"&gt;PubkeyAcceptedAlgorithms&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;rsa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Current OpenSSH turns off algorithms that old network gear still uses, and you see &lt;code&gt;no matching key exchange method found&lt;/code&gt;. The &lt;code&gt;+&lt;/code&gt; adds the old ones back for this host only, and leaves the defaults for everything else. The error message names the algorithm the device offers: use that one. See &lt;a href="https://wardterm.com/guides/no-matching-key-exchange/" rel="noopener noreferrer"&gt;no matching key exchange method&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A complete SSH config file to start from
&lt;/h2&gt;

&lt;h3&gt;
  
  
  12. Separate files with Include
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Include&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="cm"&gt;/*
&lt;/span&gt;
&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;web&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="mf"&gt;203.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;113.10&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;
    &lt;span class="nc"&gt;Port&lt;/span&gt; &lt;span class="mi"&gt;2222&lt;/span&gt;

&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;work&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;git&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_work&lt;/span&gt;
    &lt;span class="nc"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;

&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="nc"&gt;ServerAliveInterval&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="nc"&gt;ServerAliveCountMax&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
    &lt;span class="nc"&gt;IgnoreUnknown&lt;/span&gt; &lt;span class="nc"&gt;UseKeychain&lt;/span&gt;
    &lt;span class="nc"&gt;AddKeysToAgent&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="nc"&gt;UseKeychain&lt;/span&gt; &lt;span class="n"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three rules make this layout work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Include&lt;/code&gt; goes at the top. Placed after a &lt;code&gt;Host&lt;/code&gt; line, it belongs to that block. A relative path like &lt;code&gt;config.d/*&lt;/code&gt; means &lt;code&gt;~/.ssh/config.d/&lt;/code&gt;, so you can keep one file per client or project there.&lt;/li&gt;
&lt;li&gt;Specific hosts come first. For each setting SSH keeps the first value it finds, so a &lt;code&gt;Host *&lt;/code&gt; at the top would override everything below it.&lt;/li&gt;
&lt;li&gt;Do not put &lt;code&gt;IdentityFile&lt;/code&gt; in &lt;code&gt;Host *&lt;/code&gt;. It adds that key to every host, on top of the ones you named.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How do you check an SSH config before you connect?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ssh -G&lt;/code&gt; prints the final settings for a name without connecting. Filter the lines you care about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh -G github-work &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s1"&gt;'^(hostname|user|port|identityfile|proxyjump) '&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To try a new block without touching your real file, keep it apart and point SSH at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh -F ~/test-config -G web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a value is not the one you wrote, an earlier block set it first. Look for a &lt;code&gt;Host *&lt;/code&gt; or a pattern above yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the same SSH config examples on iPhone and iPad
&lt;/h2&gt;

&lt;p&gt;A config file lives on one computer. Your phone has never heard of &lt;code&gt;web&lt;/code&gt; or &lt;code&gt;github-work&lt;/code&gt;, and typing the real addresses on a small keyboard is where the mistakes start.&lt;/p&gt;

&lt;p&gt;Wardterm imports the file instead of making you retype it. On Mac, choose &lt;code&gt;~/.ssh/config&lt;/code&gt; under Import; on iPhone and iPad, pick the file with &lt;strong&gt;SSH config file&lt;/strong&gt;. Each &lt;code&gt;Host&lt;/code&gt; becomes a server with its address, port, user and key. &lt;code&gt;ProxyJump&lt;/code&gt; becomes the chain of jump servers, &lt;code&gt;LocalForward&lt;/code&gt;, &lt;code&gt;RemoteForward&lt;/code&gt; and &lt;code&gt;DynamicForward&lt;/code&gt; become saved tunnels, and &lt;code&gt;Include&lt;/code&gt; files and &lt;code&gt;Host *&lt;/code&gt; options are read too. See &lt;a href="https://wardterm.com/docs/import-hosts/" rel="noopener noreferrer"&gt;Import hosts&lt;/a&gt; for every field.&lt;/p&gt;

&lt;p&gt;With sync on, the same servers and keys reach your other devices in the &lt;a href="https://wardterm.com/encrypted-vault/" rel="noopener noreferrer"&gt;encrypted vault&lt;/a&gt;, so the import happens once.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your Host blocks become servers in &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt;, with jump hosts and tunnels ready, on Mac, Windows, Linux, iPhone, iPad and Android. Start free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://wardterm.com/blog/ssh-config-examples/" rel="noopener noreferrer"&gt;Wardterm blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>linux</category>
      <category>devops</category>
      <category>git</category>
    </item>
    <item>
      <title>Linux server security checklist: 12 steps for a new VPS</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:26:37 +0000</pubDate>
      <link>https://dev.to/wardterm/linux-server-security-checklist-12-steps-for-a-new-vps-3n95</link>
      <guid>https://dev.to/wardterm/linux-server-security-checklist-12-steps-for-a-new-vps-3n95</guid>
      <description>&lt;h2&gt;
  
  
  The Linux server security checklist
&lt;/h2&gt;

&lt;p&gt;A new VPS gets its first SSH login attempts within minutes of booting. Do these in order, on Ubuntu or Debian; the commands are similar on other distributions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install updates.&lt;/li&gt;
&lt;li&gt;Turn on automatic security updates.&lt;/li&gt;
&lt;li&gt;Create a user with sudo.&lt;/li&gt;
&lt;li&gt;Sign in with an SSH key.&lt;/li&gt;
&lt;li&gt;Turn off root login.&lt;/li&gt;
&lt;li&gt;Turn off password login.&lt;/li&gt;
&lt;li&gt;Turn on a firewall.&lt;/li&gt;
&lt;li&gt;Install fail2ban.&lt;/li&gt;
&lt;li&gt;Close services you do not need.&lt;/li&gt;
&lt;li&gt;Read the login log.&lt;/li&gt;
&lt;li&gt;Set up backups, and test a restore.&lt;/li&gt;
&lt;li&gt;Protect the keys on your own devices.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; keeps your servers and keys in an encrypted vault, and can keep a key in the secure chip of your Mac or iPhone, confirmed with Touch ID or Face ID.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Steps 1 and 2: how do you keep the server updated?
&lt;/h2&gt;

&lt;p&gt;Install what is waiting, then let security fixes install themselves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo apt upgrade -y
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer Yes. Security updates now install daily. When a kernel update arrives, &lt;code&gt;/var/run/reboot-required&lt;/code&gt; appears; reboot at a quiet time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps 3 and 4: a sudo user and an SSH key
&lt;/h2&gt;

&lt;p&gt;Daily work happens as a normal user, never as root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adduser deploy
usermod -aG sudo deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From your own computer, copy your public key to the new user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-copy-id deploy@203.0.113.10
ssh deploy@203.0.113.10        &lt;span class="c"&gt;# should not ask for a password&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No key yet? &lt;code&gt;ssh-keygen -t ed25519&lt;/code&gt; makes one; our guide to &lt;a href="https://wardterm.com/guides/generate-ed25519-ssh-key/" rel="noopener noreferrer"&gt;generating an ed25519 key&lt;/a&gt; explains the passphrase. For the user setup in detail, see &lt;a href="https://wardterm.com/guides/create-ssh-user-sudo/" rel="noopener noreferrer"&gt;creating an SSH user with sudo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps 5 and 6: how do you secure SSH on a new server?
&lt;/h2&gt;

&lt;p&gt;Put your changes in a drop-in file, so package updates never overwrite them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo tee /etc/ssh/sshd_config.d/10-hardening.conf &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
EOF
sudo sshd -t &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo systemctl reload ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On some systems the service is called &lt;code&gt;sshd&lt;/code&gt; instead of &lt;code&gt;ssh&lt;/code&gt;. Before you close your session, open a second terminal and check that you can still sign in. If you cannot, fix it from the first one.&lt;/p&gt;

&lt;p&gt;Check what the server really uses, since the first value read wins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo sshd -T &lt;span class="o"&gt;|&lt;/span&gt; grep -Ei &lt;span class="s1"&gt;'permitrootlogin|passwordauthentication'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More settings worth a look are in our &lt;a href="https://wardterm.com/guides/harden-sshd-config/" rel="noopener noreferrer"&gt;sshd_config hardening guide&lt;/a&gt; and the guide to &lt;a href="https://wardterm.com/guides/disable-ssh-password-login/" rel="noopener noreferrer"&gt;disabling password login&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps 7 and 8: a firewall and fail2ban
&lt;/h2&gt;

&lt;p&gt;Allow SSH first, then turn the firewall on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp      &lt;span class="c"&gt;# only if it serves websites&lt;/span&gt;
sudo ufw &lt;span class="nb"&gt;enable&lt;/span&gt;
sudo ufw status verbose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your cloud provider may have its own firewall too; keep the two in step. See &lt;a href="https://wardterm.com/guides/ufw-allow-ssh/" rel="noopener noreferrer"&gt;allow SSH through UFW&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;fail2ban reads the log and blocks addresses that keep failing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install -y fail2ban
sudo tee /etc/fail2ban/jail.local &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;sshd&lt;span class="o"&gt;]&lt;/span&gt;
enabled &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
maxretry &lt;span class="o"&gt;=&lt;/span&gt; 5
bantime &lt;span class="o"&gt;=&lt;/span&gt; 1h
EOF
sudo systemctl restart fail2ban
sudo fail2ban-client status sshd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our &lt;a href="https://wardterm.com/guides/fail2ban-ssh/" rel="noopener noreferrer"&gt;fail2ban guide&lt;/a&gt; covers longer bans for repeat visitors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps 9 and 10: what is running, and who is knocking?
&lt;/h2&gt;

&lt;p&gt;List every port that listens, and the program behind it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ss -tulpn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anything you do not recognise, stop it or bind it to &lt;code&gt;127.0.0.1&lt;/code&gt;. A database should never listen on the public address; reach it through an SSH tunnel instead (see &lt;a href="https://wardterm.com/guides/database-through-ssh-tunnel/" rel="noopener noreferrer"&gt;database through an SSH tunnel&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Then look at the log once in a while:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo journalctl -u ssh --since &lt;span class="s2"&gt;"24 hours ago"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -c &lt;span class="s2"&gt;"Invalid user"&lt;/span&gt;
last -n 10          &lt;span class="c"&gt;# recent successful logins&lt;/span&gt;
sudo lastb -n 10    &lt;span class="c"&gt;# recent failed logins&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thousands of failed attempts are normal noise. A successful login you do not recognise is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 11: why do backups belong on a security checklist?
&lt;/h2&gt;

&lt;p&gt;Because the most common disaster is not an attacker. It is a wrong &lt;code&gt;rm&lt;/code&gt;, a failed disk or a bad migration. A backup counts only if you have restored from it once.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn on your provider's snapshots for the whole disk.&lt;/li&gt;
&lt;li&gt;Back up data, such as databases and uploads, to another place, for example with &lt;code&gt;restic&lt;/code&gt; or &lt;code&gt;borg&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Restore one file today, on purpose, so you know how.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To make the wrong command less likely in the first place, make production look different. Mark the server as Production in Wardterm and every session on it carries a clear label, so you always know where you are typing. Our guide to &lt;a href="https://wardterm.com/guides/avoid-mistakes-on-production-servers/" rel="noopener noreferrer"&gt;avoiding mistakes on production servers&lt;/a&gt; has more habits that help.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; can record your sessions with passwords hidden, so after an incident you can replay exactly what ran on the server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 12: how do you protect the keys on your own devices?
&lt;/h2&gt;

&lt;p&gt;A hardened server is only as safe as the laptop that holds its key. Three habits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One key per device.&lt;/strong&gt; When a laptop is lost, remove its line from &lt;code&gt;authorized_keys&lt;/code&gt; and nothing else changes. See &lt;a href="https://wardterm.com/guides/revoke-ssh-key-offboarding/" rel="noopener noreferrer"&gt;revoking an SSH key&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A passphrase or a secure chip.&lt;/strong&gt; A key in the Secure Enclave cannot be copied off the device at all; each use is confirmed with Touch ID or Face ID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the fingerprint on first connect.&lt;/strong&gt; Compare it with the one your provider shows in its console.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Wardterm does all three: it keeps keys in an encrypted vault, can create a key inside the secure chip of your Mac, iPhone or iPad, and shows the server's fingerprint the first time you connect. See &lt;a href="https://wardterm.com/docs/device-keys/" rel="noopener noreferrer"&gt;keys on this device&lt;/a&gt; and &lt;a href="https://wardterm.com/docs/fingerprints/" rel="noopener noreferrer"&gt;server fingerprints&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the Linux server security checklist leave out?
&lt;/h2&gt;

&lt;p&gt;These twelve steps cover the ground every server needs. Beyond them, depending on what you run: TLS for websites, a web application firewall, SSH certificates for larger teams (see &lt;a href="https://wardterm.com/guides/ssh-certificates-explained/" rel="noopener noreferrer"&gt;SSH certificates&lt;/a&gt;), and session recording for audits. Start with the twelve; they stop the attacks that actually happen to a new VPS.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add your hardened servers to &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt;, sign in with a key from the secure chip, and see stats and containers next to the terminal. Free to start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://wardterm.com/blog/linux-server-security-checklist/" rel="noopener noreferrer"&gt;Wardterm blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>ssh</category>
      <category>devops</category>
    </item>
    <item>
      <title>SSH commands cheat sheet: connect, keys, files, tunnels and debug</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:26:18 +0000</pubDate>
      <link>https://dev.to/wardterm/ssh-commands-cheat-sheet-connect-keys-files-tunnels-and-debug-1dj</link>
      <guid>https://dev.to/wardterm/ssh-commands-cheat-sheet-connect-keys-files-tunnels-and-debug-1dj</guid>
      <description>&lt;h2&gt;
  
  
  The SSH commands cheat sheet at a glance
&lt;/h2&gt;

&lt;p&gt;The ten commands below cover most days. The sections after them group the rest by task, each with one line on what it does and a link to a full guide when you need more.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Connect&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh deploy@203.0.113.10&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connect on another port&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh -p 2222 deploy@203.0.113.10&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Make a key&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "you@laptop"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Put the key on a server&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh-copy-id deploy@203.0.113.10&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run one command&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh deploy@web1 'uptime'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upload a file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;scp app.tar.gz deploy@web1:/tmp/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sync a folder&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rsync -avz site/ deploy@web1:/var/www/site/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reach a remote port&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh -N -L 5432:localhost:5432 deploy@db1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;See what goes wrong&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ssh -v deploy@web1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Close a frozen session&lt;/td&gt;
&lt;td&gt;Enter, then &lt;code&gt;~.&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Save the commands from this page in &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; and run them in any session, or on several servers at once. Free to start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you connect to a server with SSH?
&lt;/h2&gt;

&lt;p&gt;The address can be an IP or a host name. If you leave out the user, SSH uses your local user name, which is rarely what the server expects.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens a shell on the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -p 2222 user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Connects to a port other than 22.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -i ~/.ssh/id_ed25519_work user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Signs in with a specific key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh user@host 'df -h'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs one command and returns.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -t user@host top&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs a full-screen program that needs a terminal.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -J jump@bastion user@10.0.1.5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Goes through a jump host to a private server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -o ServerAliveInterval=30 user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sends a keepalive every 30 seconds so idle sessions stay open.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;exit&lt;/code&gt; or Ctrl+D&lt;/td&gt;
&lt;td&gt;Leaves the session.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Quote a remote command in single quotes so that your local shell does not expand &lt;code&gt;$HOME&lt;/code&gt; or &lt;code&gt;*&lt;/code&gt; before it reaches the server. More in &lt;a href="https://wardterm.com/guides/run-command-over-ssh/" rel="noopener noreferrer"&gt;how to run a command over SSH&lt;/a&gt; and &lt;a href="https://wardterm.com/guides/proxyjump-jump-host/" rel="noopener noreferrer"&gt;ProxyJump and jump hosts&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH key commands: ssh-keygen and ssh-copy-id
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "you@laptop"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes a new Ed25519 key pair in &lt;code&gt;~/.ssh&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-copy-id -i ~/.ssh/id_ed25519.pub user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds the public key to the server's &lt;code&gt;authorized_keys&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -p -f ~/.ssh/id_ed25519&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds or changes the passphrase.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -y -f ~/.ssh/id_ed25519 &amp;gt; id_ed25519.pub&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rebuilds a lost public key from the private key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -lf ~/.ssh/id_ed25519.pub&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows the key's fingerprint.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -c -C "new comment" -f ~/.ssh/id_ed25519&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Changes the comment at the end of the key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -t ed25519-sk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes a key on a FIDO2 security key, such as a YubiKey.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The private key never leaves your computer: only the &lt;code&gt;.pub&lt;/code&gt; file goes to servers. On the server, keep &lt;code&gt;~/.ssh&lt;/code&gt; at &lt;code&gt;700&lt;/code&gt; and &lt;code&gt;authorized_keys&lt;/code&gt; at &lt;code&gt;600&lt;/code&gt;: if others can write to them, sshd ignores the key. Step by step: &lt;a href="https://wardterm.com/guides/generate-ed25519-ssh-key/" rel="noopener noreferrer"&gt;generate an Ed25519 key&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which SSH config commands save the most typing?
&lt;/h2&gt;

&lt;p&gt;Every flag in the sections above can live in &lt;code&gt;~/.ssh/config&lt;/code&gt;, under a short name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;web1&lt;/span&gt;
    &lt;span class="nc"&gt;HostName&lt;/span&gt; &lt;span class="mf"&gt;203.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;113.10&lt;/span&gt;
    &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt;
    &lt;span class="nc"&gt;Port&lt;/span&gt; &lt;span class="mi"&gt;2222&lt;/span&gt;
    &lt;span class="nc"&gt;IdentityFile&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;id_ed25519_work&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;ssh web1&lt;/code&gt;, &lt;code&gt;scp file web1:&lt;/code&gt; and &lt;code&gt;rsync ... web1:&lt;/code&gt; all use those settings. Two commands help when a block does not behave:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ssh -G web1&lt;/code&gt; prints every setting SSH will use for that name, without connecting.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh -F ./test-config -G web1&lt;/code&gt; does the same for a file you are still editing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ready-made blocks for GitHub accounts, jump hosts and keepalive are in &lt;a href="https://wardterm.com/blog/ssh-config-examples/" rel="noopener noreferrer"&gt;SSH config examples&lt;/a&gt;, and the rules behind them in &lt;a href="https://wardterm.com/guides/ssh-config-file/" rel="noopener noreferrer"&gt;the SSH config file guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you copy files over SSH?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scp report.pdf user@host:/tmp/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Uploads a file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scp user@host:/var/log/syslog .&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Downloads a file to the current folder.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scp -r site/ user@host:~/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Copies a folder.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rsync -avz --progress site/ user@host:/var/www/site/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sends only what changed, with progress.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rsync -avz --delete site/ user@host:/var/www/site/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Also removes files that are gone locally. Try &lt;code&gt;-n&lt;/code&gt; first for a dry run.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sftp user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens an interactive session with &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;get&lt;/code&gt; and &lt;code&gt;put&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Since OpenSSH 9.0, &lt;code&gt;scp&lt;/code&gt; uses the SFTP protocol underneath; &lt;code&gt;scp -O&lt;/code&gt; brings back the old one for servers that need it. The trailing slash matters in rsync: &lt;code&gt;site/&lt;/code&gt; copies the contents, &lt;code&gt;site&lt;/code&gt; copies the folder itself. See &lt;a href="https://wardterm.com/guides/scp-examples/" rel="noopener noreferrer"&gt;scp examples&lt;/a&gt; and &lt;a href="https://wardterm.com/guides/rsync-over-ssh/" rel="noopener noreferrer"&gt;rsync over SSH&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When you would rather drag files than type paths, the &lt;a href="https://wardterm.com/docs/files/" rel="noopener noreferrer"&gt;Files panel in Wardterm&lt;/a&gt; opens the same server over SFTP, with two panes on Mac and an editor that keeps earlier versions of each file.&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH port forwarding commands: -L, -R and -D
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -N -L 5432:localhost:5432 user@db1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Local: port 5432 on your computer reaches port 5432 on the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -N -L 8080:10.0.1.20:80 user@bastion&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Local, to a third machine that only the server can reach.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -N -R 8080:localhost:3000 user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remote: port 8080 on the server reaches port 3000 on your computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -N -D 1080 user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dynamic: a SOCKS proxy on port 1080 that sends traffic out from the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -f -N -L 5432:localhost:5432 user@db1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The same local tunnel, in the background.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;-N&lt;/code&gt; means no shell, only the tunnel. If a port is already taken, add &lt;code&gt;-o ExitOnForwardFailure=yes&lt;/code&gt; so SSH stops instead of opening a session without the tunnel. All three kinds are explained in &lt;a href="https://wardterm.com/guides/ssh-tunnels-local-remote-dynamic/" rel="noopener noreferrer"&gt;SSH tunnels: local, remote and dynamic&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt;, a saved tunnel shows whether it is Open or Failed, and starts or stops with one tap. Your LocalForward lines come in with the import.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you use ssh-agent?
&lt;/h2&gt;

&lt;p&gt;The agent holds your unlocked keys, so you type a passphrase once instead of at every connection.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;eval "$(ssh-agent -s)"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts an agent in this shell (Linux; macOS starts one for you).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-add ~/.ssh/id_ed25519&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds a key to the agent.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-add --apple-use-keychain ~/.ssh/id_ed25519&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;On macOS, also stores the passphrase in the Keychain.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-add -l&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists the keys the agent holds.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-add -t 1h ~/.ssh/id_ed25519&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds a key for one hour only.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-add -D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes every key from the agent.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -A user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Forwards the agent to the server, so it can use your keys for the next hop.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Forward the agent only to servers you trust: anyone with root there can use your keys while you are connected. To reach a server behind another, &lt;code&gt;-J&lt;/code&gt; is the safer choice. The macOS details are in &lt;a href="https://wardterm.com/guides/ssh-agent-macos-keychain/" rel="noopener noreferrer"&gt;ssh-agent and the macOS Keychain&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you debug an SSH connection?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -v user@host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verbose output: which keys are offered and where it stops. &lt;code&gt;-vvv&lt;/code&gt; for more.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh -G host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows the settings SSH will use, after your config.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nc -vz host 22&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Checks that the port answers at all.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -R host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes an old host key from &lt;code&gt;known_hosts&lt;/code&gt; after a reinstall.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -F host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Finds the saved host key for a name.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keyscan -t ed25519 host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetches the host key the server presents now.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enter, then &lt;code&gt;~.&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Closes a frozen session.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Only remove a host key when you know why it changed, such as a rebuilt server. Otherwise compare it with the fingerprint from the server's console first. The full method, from DNS to the server log, is in &lt;a href="https://wardterm.com/guides/debug-ssh-connection/" rel="noopener noreferrer"&gt;how to debug an SSH connection&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server side: the sshd commands to know
&lt;/h2&gt;

&lt;p&gt;These run on the server, usually with &lt;code&gt;sudo&lt;/code&gt;. On Debian and Ubuntu the service is &lt;code&gt;ssh&lt;/code&gt;; on Fedora, RHEL and most others it is &lt;code&gt;sshd&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sudo sshd -t&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Checks &lt;code&gt;sshd_config&lt;/code&gt; for errors. Run it before every restart.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sudo sshd -T | grep -i passwordauthentication&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows the setting sshd really uses.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl restart ssh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Restarts the service after a change.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sudo journalctl -u ssh -f&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Follows the SSH log, including failed logins.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Prints the host key fingerprint, to compare on first connect.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;chmod 700 ~/.ssh &amp;amp;&amp;amp; chmod 600 ~/.ssh/authorized_keys&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fixes the permissions that make keys fail.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;last -n 10&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists the latest logins.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Keep a second session open while you change &lt;code&gt;sshd_config&lt;/code&gt;: if the new settings lock you out, the open one still works. For the settings worth changing, see &lt;a href="https://wardterm.com/guides/harden-sshd-config/" rel="noopener noreferrer"&gt;how to harden sshd_config&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn your SSH commands cheat sheet into saved commands
&lt;/h2&gt;

&lt;p&gt;A cheat sheet helps until you notice you type the same five lines every week. In Wardterm, &lt;a href="https://wardterm.com/docs/saved-commands/" rel="noopener noreferrer"&gt;saved commands&lt;/a&gt; keep them by name, ready on every server. A tap writes a command on the line or runs it, and &lt;strong&gt;Run on several servers&lt;/strong&gt; shows the exit code and output of each server.&lt;/p&gt;

&lt;p&gt;The rest of this page has a home in the app too. &lt;a href="https://wardterm.com/docs/import-hosts/" rel="noopener noreferrer"&gt;Import&lt;/a&gt; turns your &lt;code&gt;~/.ssh/config&lt;/code&gt; into servers, with keys, jump hosts and tunnels.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Import your ssh config, save your commands and connect from Mac, Windows, Linux, iPhone, iPad or Android. Start free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://wardterm.com/blog/ssh-commands-cheat-sheet/" rel="noopener noreferrer"&gt;Wardterm blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>linux</category>
      <category>devops</category>
      <category>cheatsheet</category>
    </item>
    <item>
      <title>How to manage Docker over SSH: contexts, logs, Compose and cleanup</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:48:00 +0000</pubDate>
      <link>https://dev.to/wardterm/how-to-manage-docker-over-ssh-contexts-logs-compose-and-cleanup-2ale</link>
      <guid>https://dev.to/wardterm/how-to-manage-docker-over-ssh-contexts-logs-compose-and-cleanup-2ale</guid>
      <description>&lt;h2&gt;
  
  
  Three ways to manage Docker over SSH
&lt;/h2&gt;

&lt;p&gt;You do not need to expose the Docker API to work with containers on a server. SSH is already there, and it is enough.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run commands on the server&lt;/strong&gt;: &lt;code&gt;ssh user@server docker ps&lt;/code&gt;. Nothing to set up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Docker context&lt;/strong&gt;: your local &lt;code&gt;docker&lt;/code&gt; command drives the server's Docker through SSH. Best for daily work from a laptop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A containers panel in your SSH client&lt;/strong&gt;: the list, logs and actions with a tap, also from a phone.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; shows the Docker containers of any SSH server, grouped by Compose project, with live logs, a shell and restart. Nothing to install on the server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you run Docker commands over SSH directly?
&lt;/h2&gt;

&lt;p&gt;The simplest way works with any server you can reach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh deploy@203.0.113.10 docker ps
ssh deploy@203.0.113.10 &lt;span class="s1"&gt;'docker logs --tail 50 web'&lt;/span&gt;
ssh -t deploy@203.0.113.10 docker &lt;span class="nb"&gt;exec&lt;/span&gt; -it web sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use quotes when the command has options or pipes, and &lt;code&gt;-t&lt;/code&gt; when you need an interactive terminal. Our guide to &lt;a href="https://wardterm.com/guides/run-command-over-ssh/" rel="noopener noreferrer"&gt;running commands over SSH&lt;/a&gt; explains quoting and exit codes.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you manage Docker over SSH with a context?
&lt;/h2&gt;

&lt;p&gt;A context tells your local Docker which daemon to talk to. Create one for the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker context create prod --docker &lt;span class="s2"&gt;"host=ssh://deploy@203.0.113.10"&lt;/span&gt;
docker context use prod
docker ps                  &lt;span class="c"&gt;# runs on the server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything now runs remotely: &lt;code&gt;docker images&lt;/code&gt;, &lt;code&gt;docker stats&lt;/code&gt;, &lt;code&gt;docker compose&lt;/code&gt;. Switch back with &lt;code&gt;docker context use default&lt;/code&gt;. To run one command on another context without switching, add &lt;code&gt;--context&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker --context prod ps
docker context ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server needs nothing new: no open port, no TLS certificates. It only needs Docker and SSH. Your local machine needs the Docker CLI, which you get with Docker Desktop or the &lt;code&gt;docker&lt;/code&gt; package.&lt;/p&gt;

&lt;h3&gt;
  
  
  One-off: DOCKER_HOST
&lt;/h3&gt;

&lt;p&gt;For a script or a single command, set the variable instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;DOCKER_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ssh://deploy@203.0.113.10 docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Make it faster
&lt;/h3&gt;

&lt;p&gt;Each Docker command opens a new SSH connection. Reuse one with multiplexing in &lt;code&gt;~/.ssh/config&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="mf"&gt;203.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;113.10&lt;/span&gt;
    &lt;span class="nc"&gt;ControlMaster&lt;/span&gt; &lt;span class="n"&gt;auto&lt;/span&gt;
    &lt;span class="nc"&gt;ControlPath&lt;/span&gt; &lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cm&lt;/span&gt;&lt;span class="o"&gt;-%&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;@&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;
    &lt;span class="nc"&gt;ControlPersist&lt;/span&gt; &lt;span class="mi"&gt;10m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our guide to &lt;a href="https://wardterm.com/guides/ssh-multiplexing-controlmaster/" rel="noopener noreferrer"&gt;SSH multiplexing&lt;/a&gt; explains each line.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you use docker compose on a remote server?
&lt;/h2&gt;

&lt;p&gt;With the context active, Compose runs on the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker context use prod
docker compose up -d
docker compose ps
docker compose logs -f --tail 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things surprise people. Build contexts in the compose file are read on your machine and sent to the server. Bind mounts, such as &lt;code&gt;./data:/data&lt;/code&gt;, refer to folders on the server. If your compose file and data live on the server, it is often simpler to SSH in and run Compose there.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Docker commands you use most over SSH
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;List running containers&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Include stopped ones&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker ps -a&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Follow logs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker logs -f --tail 100 web&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shell inside&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker exec -it web sh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Restart one&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker restart web&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CPU and memory&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker stats --no-stream&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disk used by Docker&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker system df&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update a Compose project&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker compose pull &amp;amp;&amp;amp; docker compose up -d&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For more on shells in containers, see &lt;a href="https://wardterm.com/guides/ssh-into-docker-container/" rel="noopener noreferrer"&gt;how to SSH into a Docker container&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does Docker say permission denied over SSH?
&lt;/h2&gt;

&lt;p&gt;The message &lt;code&gt;permission denied while trying to connect to the Docker daemon socket&lt;/code&gt; means the SSH user cannot use Docker. Two fixes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the user to the docker group, then sign out and back in:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo usermod -aG docker &lt;span class="nv"&gt;$USER&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Or keep Docker behind sudo and run &lt;code&gt;sudo docker ...&lt;/code&gt; on the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Know what the first one means: a member of the docker group can start a container that mounts the whole disk, which is root in all but name. Give it only to users who would have sudo anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you clean up Docker disk space safely?
&lt;/h2&gt;

&lt;p&gt;A server that builds or pulls images fills its disk over time. Look first, then delete:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker system df                 &lt;span class="c"&gt;# what uses space&lt;/span&gt;
docker image prune               &lt;span class="c"&gt;# dangling images only&lt;/span&gt;
docker image prune -a            &lt;span class="c"&gt;# every image no container uses&lt;/span&gt;
docker builder prune             &lt;span class="c"&gt;# build cache&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be careful with &lt;code&gt;docker system prune --volumes&lt;/code&gt;: it deletes unused volumes, and a volume holds data, such as a database you stopped for a minute. When in doubt, list volumes with &lt;code&gt;docker volume ls -f dangling=true&lt;/code&gt; and delete them one by one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt;, Clean up shows how much each item frees, from stopped containers to build cache, and you choose what goes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you manage Docker over SSH from an iPhone or iPad?
&lt;/h2&gt;

&lt;p&gt;Typing &lt;code&gt;docker logs -f&lt;/code&gt; on a phone keyboard works, but it is not much fun at 2 a.m. Wardterm has a Containers panel for every SSH server, on iPhone, iPad, Android and Mac. It uses the server's own &lt;code&gt;docker&lt;/code&gt; or &lt;code&gt;podman&lt;/code&gt; command, so there is nothing to install.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Containers grouped by Compose project, with state, image and ports, and stopped ones folded away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logs&lt;/strong&gt; that follow live, &lt;strong&gt;Shell&lt;/strong&gt; in a new session, &lt;strong&gt;Restart&lt;/strong&gt;, &lt;strong&gt;Stop&lt;/strong&gt; and &lt;strong&gt;Start&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;For a Compose project: logs of all its containers, the compose file in the editor, and &lt;strong&gt;Update images&lt;/strong&gt;, which pulls and recreates only what changed.&lt;/li&gt;
&lt;li&gt;CPU and memory bars per container, and environment variables hidden until you ask.&lt;/li&gt;
&lt;li&gt;When the user needs sudo for Docker, the app asks for the password once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The panel also sits in the side panel of a terminal, next to the live &lt;a href="https://wardterm.com/docs/server-stats/" rel="noopener noreferrer"&gt;server stats&lt;/a&gt;. See &lt;a href="https://wardterm.com/docs/containers/" rel="noopener noreferrer"&gt;Docker containers&lt;/a&gt; for every action.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Live logs, a shell and restart for every container on your servers, from iPhone, iPad or Mac. Start free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://wardterm.com/blog/manage-docker-over-ssh/" rel="noopener noreferrer"&gt;Wardterm blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>ssh</category>
      <category>devops</category>
      <category>linux</category>
    </item>
    <item>
      <title>SSH keys in the Secure Enclave: options for every Apple device</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:45:05 +0000</pubDate>
      <link>https://dev.to/wardterm/ssh-keys-in-the-secure-enclave-options-for-every-apple-device-1701</link>
      <guid>https://dev.to/wardterm/ssh-keys-in-the-secure-enclave-options-for-every-apple-device-1701</guid>
      <description>&lt;h2&gt;
  
  
  What are SSH keys in the Secure Enclave?
&lt;/h2&gt;

&lt;p&gt;A normal SSH key is a file in &lt;code&gt;~/.ssh&lt;/code&gt;. Anything that can read that file, a stolen backup or a bad package in your shell, can copy the key and use it from anywhere. A key in the Secure Enclave is made inside the security chip of the device, and the private part never leaves it. Your computer asks the chip to sign; the chip answers, optionally after Touch ID or Face ID.&lt;/p&gt;

&lt;p&gt;Four ways to get there, from the most built-in to the most portable:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Where the key lives&lt;/th&gt;
&lt;th&gt;Key type&lt;/th&gt;
&lt;th&gt;Devices&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;macOS built-in (&lt;code&gt;sc_auth&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Secure Enclave of the Mac&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;sk-ecdsa&lt;/code&gt; P-256&lt;/td&gt;
&lt;td&gt;Mac&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Secure Enclave agent app&lt;/td&gt;
&lt;td&gt;Secure Enclave of the Mac&lt;/td&gt;
&lt;td&gt;ECDSA P-256&lt;/td&gt;
&lt;td&gt;Mac&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SSH app with device keys&lt;/td&gt;
&lt;td&gt;Secure Enclave of each device&lt;/td&gt;
&lt;td&gt;ECDSA P-256&lt;/td&gt;
&lt;td&gt;Mac, iPhone, iPad&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FIDO2 security key&lt;/td&gt;
&lt;td&gt;The security key itself&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ed25519-sk&lt;/code&gt; or &lt;code&gt;ecdsa-sk&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Any computer you plug it into&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is not the Secure Enclave, but people search for it in the same breath, so it has its own section below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why keep SSH keys in the Secure Enclave?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The key cannot be copied.&lt;/strong&gt; Apple's documentation is plain about it: there is no way to move key data into or out of the Secure Enclave. Malware can ask for a signature while it runs on your Mac, but it cannot take the key away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Each use can need you.&lt;/strong&gt; With biometrics on, every sign-in waits for Touch ID or Face ID, so a hidden process cannot sign quietly in the background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No passphrase to remember.&lt;/strong&gt; The chip guards the key instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trade-offs come from the same design. You cannot back the key up or carry it to a new Mac, so each device gets its own key. The chip only knows NIST P-256 curves, so the key is ECDSA, never Ed25519. And Apple lists the hardware: iPhones and iPads with an A7 chip or later, and Macs with Apple silicon or with the Touch Bar and Touch ID.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;Wardterm&lt;/a&gt; makes SSH keys in the secure chip of your Mac, iPhone or iPad and asks for Face ID or Touch ID at each sign-in. Free to start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Can you make Secure Enclave SSH keys on macOS without extra apps?
&lt;/h2&gt;

&lt;p&gt;Yes, on recent macOS. Since macOS Tahoe, the system library &lt;code&gt;/usr/lib/ssh-keychain.dylib&lt;/code&gt;, long used for smart cards, also works as a security key provider for the ssh that ships with macOS. Apple documents the pieces in the &lt;code&gt;sc_auth&lt;/code&gt; and &lt;code&gt;ssh-keychain&lt;/code&gt; man pages, and developers mapped out the steps below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a key in the Secure Enclave that needs Touch ID (&lt;code&gt;-ne&lt;/code&gt; means not exportable):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sc_auth create-ctk-identity -l ssh -k p-256-ne -t bio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check it is there, with its SSH fingerprint:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sc_auth list-ctk-identities -t ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Write a small handle file for ssh in &lt;code&gt;~/.ssh&lt;/code&gt;. It holds a reference, not the key. Press Enter at the PIN prompt, then touch the sensor:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.ssh
ssh-keygen -w /usr/lib/ssh-keychain.dylib -K -N &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This writes &lt;code&gt;id_ecdsa_sk_rk&lt;/code&gt; and &lt;code&gt;id_ecdsa_sk_rk.pub&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tell ssh where the provider is, in &lt;code&gt;~/.zprofile&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;SSH_SK_PROVIDER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/ssh-keychain.dylib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Copy the public key to a server and connect:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-copy-id -i ~/.ssh/id_ecdsa_sk_rk.pub deploy@203.0.113.10
ssh -i ~/.ssh/id_ecdsa_sk_rk deploy@203.0.113.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To load it into the agent instead of naming the file, run &lt;code&gt;ssh-add -K -S /usr/lib/ssh-keychain.dylib&lt;/code&gt;. Two things to know: these keys appear to servers as &lt;code&gt;sk-ecdsa-sha2-nistp256@openssh.com&lt;/code&gt;, which needs OpenSSH 8.2 or later on the server, and they live on this Mac only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Secure Enclave SSH agents with Touch ID
&lt;/h2&gt;

&lt;p&gt;Before macOS had this built in, people used agent apps, and many still do. Secretive, an open-source Mac app, is the best known: it creates keys in the Secure Enclave, asks for Touch ID or an Apple Watch when one is used, and shows a notification each time a key signs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew install secretive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You then point SSH at its agent with an &lt;code&gt;IdentityAgent&lt;/code&gt; line in &lt;code&gt;~/.ssh/config&lt;/code&gt;, as its setup screen explains. The keys are plain &lt;code&gt;ecdsa-sha2-nistp256&lt;/code&gt;, so they work on any OpenSSH server, old ones included. The limit is the same as before: a Mac app, for keys on that Mac.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is an ed25519-sk key in the Secure Enclave?
&lt;/h2&gt;

&lt;p&gt;No. &lt;code&gt;ed25519-sk&lt;/code&gt; and &lt;code&gt;ecdsa-sk&lt;/code&gt; are the key types OpenSSH added in version 8.2 for FIDO2 security keys such as a YubiKey. The private key lives on the token you plug in and touch, which means it travels with you to any computer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen -t ed25519-sk -O resident -O verify-required -C &lt;span class="s2"&gt;"yubikey"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-O resident&lt;/code&gt; keeps the key on the token, so &lt;code&gt;ssh-keygen -K&lt;/code&gt; can load it on another computer. &lt;code&gt;-O verify-required&lt;/code&gt; asks for the token's PIN as well as the touch.&lt;/p&gt;

&lt;p&gt;On a Mac, the ssh that comes with the system stops with &lt;code&gt;No FIDO SecurityKeyProvider specified&lt;/code&gt; for these keys. Install OpenSSH from Homebrew (&lt;code&gt;brew install openssh&lt;/code&gt;), which brings FIDO2 support, and use that &lt;code&gt;ssh-keygen&lt;/code&gt;. The whole setup is in &lt;a href="https://wardterm.com/guides/fido2-ssh-keys-yubikey/" rel="noopener noreferrer"&gt;FIDO2 SSH keys with a YubiKey&lt;/a&gt;. In Wardterm, &lt;a href="https://wardterm.com/docs/security-keys/" rel="noopener noreferrer"&gt;Security keys&lt;/a&gt; makes the same kind of key on a YubiKey from the Keys screen of the Mac app, and its SSH agent lets Terminal and git use it too.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you use SSH keys in the Secure Enclave on iPhone and iPad?
&lt;/h2&gt;

&lt;p&gt;iOS has no terminal and no &lt;code&gt;sc_auth&lt;/code&gt;, so the SSH app has to make the key. In Wardterm this is a &lt;a href="https://wardterm.com/docs/device-keys/" rel="noopener noreferrer"&gt;key on this device&lt;/a&gt;, and it works the same on Mac, iPhone and iPad:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open Keys. On iPhone choose &lt;strong&gt;+&lt;/strong&gt;, on Mac &lt;strong&gt;New Key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Key on This Device&lt;/strong&gt; and give it a name, such as the name of the device.&lt;/li&gt;
&lt;li&gt;Leave &lt;strong&gt;Ask for Touch ID or Face ID each time it is used&lt;/strong&gt; on, then choose &lt;strong&gt;Create Key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Open the key, choose &lt;strong&gt;Add to a server&lt;/strong&gt; and pick the server. The app signs in with the current login and adds the public key to &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Use to sign in&lt;/strong&gt;. From now on each connection asks for your face or finger.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The public key is &lt;code&gt;ecdsa-sha2-nistp256&lt;/code&gt;, the type every current OpenSSH server accepts. The key shows as This device only: it is not synced, and your other devices make their own.&lt;/p&gt;

&lt;p&gt;Create a device key in Wardterm, add it to your servers with one tap, and confirm each sign-in on iPhone, iPad or Mac.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which servers accept Secure Enclave SSH keys?
&lt;/h2&gt;

&lt;p&gt;Plain ECDSA P-256 keys, from agent apps or device keys, work on any OpenSSH server with default settings. The &lt;code&gt;sk-ecdsa&lt;/code&gt; keys from the macOS built-in need OpenSSH 8.2 or later on the server, which every current Linux release has. To check a server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo sshd -T &lt;span class="o"&gt;|&lt;/span&gt; grep pubkeyacceptedalgorithms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for &lt;code&gt;ecdsa-sha2-nistp256&lt;/code&gt; or &lt;code&gt;sk-ecdsa-sha2-nistp256@openssh.com&lt;/code&gt; in the list. GitHub and the other code hosts accept both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan for a lost or replaced device
&lt;/h2&gt;

&lt;p&gt;A key that cannot be copied also cannot be restored. Plan for that on day one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One key per device.&lt;/strong&gt; A server's &lt;code&gt;authorized_keys&lt;/code&gt; holds many keys, one per line. Add the Mac, the iPhone and the iPad separately, with a comment that says which is which.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A second way in.&lt;/strong&gt; Keep a security key or a normal key with a strong passphrase in a safe place, so a lost phone does not lock you out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remove the old key.&lt;/strong&gt; When a device is gone, delete its line from every server. In Wardterm, also remove the device from your account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the keys you do want on every device, see &lt;a href="https://wardterm.com/guides/sync-ssh-keys-between-devices/" rel="noopener noreferrer"&gt;how to use SSH keys on several devices&lt;/a&gt;. With sync on, those keys travel in the &lt;a href="https://wardterm.com/encrypted-vault/" rel="noopener noreferrer"&gt;encrypted vault&lt;/a&gt;, while device keys stay on the chip where they were made.&lt;/p&gt;

&lt;p&gt;Device keys, security keys and the keys you import sit side by side in Wardterm, each one tap away from a new server. Start free.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://wardterm.com/blog/ssh-keys-secure-enclave/" rel="noopener noreferrer"&gt;Wardterm blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>security</category>
      <category>macos</category>
      <category>ios</category>
    </item>
    <item>
      <title>How to use Mosh on Mac and iPhone, and keep sessions alive with tmux</title>
      <dc:creator>Wardterm</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:12:26 +0000</pubDate>
      <link>https://dev.to/wardterm/how-to-use-mosh-on-mac-and-iphone-and-keep-sessions-alive-with-tmux-58lc</link>
      <guid>https://dev.to/wardterm/how-to-use-mosh-on-mac-and-iphone-and-keep-sessions-alive-with-tmux-58lc</guid>
      <description>&lt;p&gt;SSH drops the moment your laptop sleeps, your train goes into a tunnel or your iPhone switches from Wi-Fi to 5G. Mosh fixes the connection part. tmux fixes the "my job died with it" part. Together they make a remote shell you can close and reopen from anywhere.&lt;/p&gt;

&lt;p&gt;This guide sets up both on a Linux server and shows how to connect from a Mac and from an iPhone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short answer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# on the server&lt;/span&gt;
sudo apt install mosh tmux          &lt;span class="c"&gt;# Debian / Ubuntu&lt;/span&gt;
sudo ufw allow 60000:61000/udp      &lt;span class="c"&gt;# only if ufw is on&lt;/span&gt;

&lt;span class="c"&gt;# on the Mac&lt;/span&gt;
brew install mosh
mosh user@your-server -- tmux new -A -s main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;tmux new -A -s main&lt;/code&gt; attaches to the session called &lt;code&gt;main&lt;/code&gt; if it exists, or creates it. Run the same command again tomorrow and you are back where you left off.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Mosh does, and what it does not
&lt;/h2&gt;

&lt;p&gt;Mosh (mobile shell) logs in over SSH, starts &lt;code&gt;mosh-server&lt;/code&gt; on the remote machine, and then talks to it over UDP. Because the session is not tied to one TCP connection:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it survives a change of IP address (Wi-Fi to cellular, home to office);&lt;/li&gt;
&lt;li&gt;it survives the laptop sleeping or the iPhone locking;&lt;/li&gt;
&lt;li&gt;it shows what you type right away, even on a slow link, instead of waiting for the server's echo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it does not do: keep your programs running if the server side of the session ends, scroll back through history the way your terminal does, or forward ports. For the first two, you add tmux.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install on the server
&lt;/h2&gt;

&lt;p&gt;Debian and Ubuntu:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update
sudo apt install mosh tmux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fedora, RHEL and friends:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo dnf install mosh tmux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mosh uses one UDP port per session in the range 60000 to 61000. If a firewall is on, open it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw allow 60000:61000/udp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a cloud server, add the same range as an inbound UDP rule in the provider's firewall too.&lt;/p&gt;

&lt;p&gt;Mosh also needs a UTF-8 locale on the server. If you get an error about &lt;code&gt;LANG&lt;/code&gt; or &lt;code&gt;LC_ALL&lt;/code&gt;, this usually fixes it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo locale-gen en_US.UTF-8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Connect from a Mac
&lt;/h2&gt;

&lt;p&gt;Install the client with Homebrew and connect the same way you would with SSH:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew install mosh
mosh user@your-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If SSH runs on another port, pass the SSH command through:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mosh --ssh=&lt;span class="s2"&gt;"ssh -p 2222"&lt;/span&gt; user@your-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your &lt;code&gt;~/.ssh/config&lt;/code&gt; is used as usual, so a host alias works too: &lt;code&gt;mosh myserver&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add tmux so the work survives
&lt;/h2&gt;

&lt;p&gt;Mosh keeps the connection alive. tmux keeps the programs alive, even if you close the Mosh session on purpose or the server reboots your login.&lt;/p&gt;

&lt;p&gt;Start or reattach in one step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mosh myserver -- tmux new -A -s main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The keys you need on day one:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Keys&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl-b d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;detach: leave everything running and disconnect&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl-b c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;new window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Ctrl-b n&lt;/code&gt; / &lt;code&gt;Ctrl-b p&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;next / previous window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl-b %&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;split side by side&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl-b [&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;scroll back (press &lt;code&gt;q&lt;/code&gt; to leave)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Later, from any device:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tmux ls                  &lt;span class="c"&gt;# list sessions&lt;/span&gt;
tmux attach -t main      &lt;span class="c"&gt;# go back in&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the setup many people use to leave a long build or a database migration running on a server and check on it from the phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect from an iPhone or iPad
&lt;/h2&gt;

&lt;p&gt;iOS has no built-in terminal, so you need an SSH app that supports Mosh. Look for three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mosh support&lt;/strong&gt;, not only SSH, so the session survives the phone locking;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;key handling&lt;/strong&gt; you trust, ideally keys that never leave the device;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;your servers and keys on every device&lt;/strong&gt;, so you don't set them up again on the phone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The flow is the same as on the Mac: connect with Mosh, then &lt;code&gt;tmux new -A -s main&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We make Wardterm, an SSH client for Mac, Windows, Linux, iPhone, iPad and Android. Mosh is included on every device, and your servers, keys and saved commands live in one end-to-end encrypted vault that syncs across them, so a server you add on the Mac is already on the phone. It's free on one device: &lt;a href="https://wardterm.com/" rel="noopener noreferrer"&gt;https://wardterm.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"mosh-server: command not found"&lt;/strong&gt;&lt;br&gt;
Mosh is not installed on the server, or not on the &lt;code&gt;PATH&lt;/code&gt; of a non-interactive SSH login. Install it, or point to it: &lt;code&gt;mosh --server=/usr/local/bin/mosh-server user@host&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It hangs at "Connecting..." and then times out&lt;/strong&gt;&lt;br&gt;
UDP is blocked. Open 60000-61000/udp on the server firewall and on the cloud provider's firewall. Corporate and hotel networks often block UDP: SSH plus tmux still works there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"The locale requested by LC_ALL=... isn't available"&lt;/strong&gt;&lt;br&gt;
Generate a UTF-8 locale on the server (&lt;code&gt;sudo locale-gen en_US.UTF-8&lt;/code&gt;) or set &lt;code&gt;LANG=en_US.UTF-8&lt;/code&gt; on the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scrolling with the trackpad does nothing&lt;/strong&gt;&lt;br&gt;
Mosh does not keep scrollback. Use tmux: &lt;code&gt;Ctrl-b [&lt;/code&gt;, then arrow keys or Page Up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mosh keeps the connection alive across network changes and sleep.&lt;/li&gt;
&lt;li&gt;tmux keeps your programs alive and lets you reattach from any device.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mosh myserver -- tmux new -A -s main&lt;/code&gt; is the one command to remember.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A longer comparison of Mosh clients for Mac and iPhone is on our blog: &lt;a href="https://wardterm.com/blog/best-mosh-client/" rel="noopener noreferrer"&gt;https://wardterm.com/blog/best-mosh-client/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>mosh</category>
      <category>tmux</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
