{"id":2610,"date":"2026-03-10T18:45:53","date_gmt":"2026-03-10T18:45:53","guid":{"rendered":"https:\/\/ssblog.eu.enginyr.ing\/?p=2610"},"modified":"2026-03-10T18:59:47","modified_gmt":"2026-03-10T18:59:47","slug":"openssh-10-breaks-legacy-ssh-sftp-fix-no-matching-key-exchange-method-found","status":"publish","type":"post","link":"https:\/\/www.serverspan.com\/en\/blog\/openssh-10-breaks-legacy-ssh-sftp-fix-no-matching-key-exchange-method-found\/","title":{"rendered":"OpenSSH 10 breaks legacy SSH\/SFTP: Fix \u201cno matching key exchange method found\u201d"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If SSH or SFTP logins started failing right after an OpenSSH 10 upgrade, the usual cause is not your firewall, your users, or the SFTP subsystem. It is key exchange. OpenSSH 10 disables old finite-field Diffie-Hellman key exchange methods in <code>sshd<\/code> by default, so older clients suddenly fail with errors like <code>Unable to negotiate with x.x.x.x port 22: no matching key exchange method found<\/code>. If the client only offers legacy KEX methods such as <code>diffie-hellman-group14-sha1<\/code> or <code>diffie-hellman-group1-sha1<\/code>, the SSH transport never finishes. That means SFTP fails too, because SFTP runs on top of SSH. The subsystem is never reached.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our experience managing production Linux servers, this is exactly the kind of breakage that shows up during OS refreshes, panel migrations, and <a href=\"https:\/\/www.serverspan.com\/en\/blog\/which-vps-plan-should-you-buy-for-a-personal-website-in-2026\/\">VPS rebuilds<\/a>. Everything looks fine until one old accounting package, one embedded device, or one partner-side file transfer client stops connecting. Then you find out that \u201clegacy\u201d in SSH terms still means \u201cactively used somewhere in your business.\u201d Debian 13 makes this more common because it ships OpenSSH 10 in the default stack. If you are refreshing systems now, this class of incident is normal. It is not hypothetical.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The fix is straightforward, but you need to do it carefully. Re-enable the smallest possible legacy KEX set, validate it from logs, and plan an exit. Do not blindly paste every weak algorithm back into <code>sshd_config<\/code>. That is lazy, and it expands your attack surface for no reason.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What actually changed in OpenSSH 10<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OpenSSH 10 changed the server defaults. The important part is this: <code>sshd<\/code> no longer offers the old finite-field Diffie-Hellman families by default. On an upgraded Debian 13 server, a legacy client that still depends on one of those methods may fail before authentication even starts.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>diffie-hellman-group14-sha1<\/code> was already on the way out for years and is no longer in the default set.<\/li>\n\n\n\n<li><code>diffie-hellman-group-exchange-*<\/code> methods are also removed from the server default proposal in OpenSSH 10.<\/li>\n\n\n\n<li>If your legacy client has no overlap with the new default KEX set, the connection dies during negotiation.<\/li>\n\n\n\n<li>SFTP is affected because it uses the same SSH transport layer.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A common operational mistake is to blame SFTP itself. That is wrong. If the SSH transport cannot agree on KEX, there is no SFTP session, no chroot issue, no internal-sftp issue, and no file permission issue to debug. The first thing we check is always the negotiation failure in the SSH logs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The exact symptoms you will see<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The client side usually shows one of these:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Unable to negotiate with 203.0.113.10 port 22: no matching key exchange method found.\nTheir offer: diffie-hellman-group14-sha1\n\nUnable to negotiate with 203.0.113.10 port 22: no matching key exchange method found.\nTheir offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1\n\nConnection closed by remote host<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On the server side, you will usually find the useful evidence in one of these places:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>journalctl -u ssh<\/code> on systemd-based distributions<\/li>\n\n\n\n<li><code>\/var\/log\/auth.log<\/code> on Debian and Ubuntu if rsyslog is in use<\/li>\n\n\n\n<li><code>\/var\/log\/secure<\/code> on RHEL-based systems<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>journalctl -u ssh -n 100 --no-pager\ngrep -i \"no matching key exchange method found\" \/var\/log\/auth.log\ngrep -i \"Unable to negotiate\" \/var\/log\/auth.log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The useful line is the one that tells you what the client offered. That list determines your fix. If the log shows only <code>diffie-hellman-group14-sha1<\/code>, that is a narrower compatibility problem. If it shows <code>group1<\/code> and old SHA1-based exchange only, the client is much older and the correct answer may be \u201creplace it,\u201d not \u201ckeep weakening the server.\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Do not start with a blind global rollback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The bad fix is to throw a long list of obsolete algorithms back into <code>sshd_config<\/code> and call it done. That works, but it is the kind of shortcut that lingers for years. The right fix starts with the exact client offer shown in the logs.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the client offers <code>diffie-hellman-group14-sha1<\/code>, start there.<\/li>\n\n\n\n<li>If the client also supports something better, use that instead.<\/li>\n\n\n\n<li>If the client only works with <code>diffie-hellman-group1-sha1<\/code>, treat it as a last-resort exception.<\/li>\n\n\n\n<li>If this is a partner integration or an internal batch process, put an owner and retirement date on the exception.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After enough incident reviews, the pattern is obvious. Temporary SSH compatibility exceptions tend to become permanent unless someone writes down why they exist and who is supposed to remove them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Runbook: re-enable the minimum legacy KEX in sshd_config<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Back up the file first.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.bak.$(date +%F-%H%M%S)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then append the least-bad algorithm that matches the failing client. In most cases, start with <code>diffie-hellman-group14-sha1<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/ssh\/sshd_config\nKexAlgorithms +diffie-hellman-group14-sha1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Validate the syntax before reloading.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sshd -t<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If syntax is clean, reload.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl reload ssh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On Debian-based systems, <code>ssh<\/code> is usually the correct unit name. On some builds it may be <code>sshd<\/code>. Do not guess. Check it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status ssh\nsystemctl status sshd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then test again from the failing client or reproduce from a modern client using the same KEX constraint.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -oKexAlgorithms=diffie-hellman-group14-sha1 user@server\nsftp -oKexAlgorithms=diffie-hellman-group14-sha1 user@server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If that works, stop there. Do not add more.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When group14-sha1 is not enough<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Some older clients do not offer anything beyond <code>diffie-hellman-group1-sha1<\/code> or old group-exchange variants. That is where you need judgment.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Better option:<\/strong> replace or upgrade the client.<\/li>\n\n\n\n<li><strong>Acceptable stopgap:<\/strong> enable one additional method temporarily, document it, and isolate the exposure.<\/li>\n\n\n\n<li><strong>Bad idea:<\/strong> dump <code>group1<\/code>, old CBC ciphers, and old MACs back into the global defaults with no controls.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you absolutely must support a very old endpoint for a short period, the config might look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/ssh\/sshd_config\nKexAlgorithms +diffie-hellman-group14-sha1,+diffie-hellman-group1-sha1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That is ugly. Treat it like an incident workaround, not a design choice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our experience, the first thing that breaks after re-enabling old KEX is not always KEX itself. It is often the next negotiation stage. A client that needs <code>group1<\/code> may also need old host key or cipher support. If you see the error move from KEX failure to host key or cipher mismatch, that is your signal that the client is too old to keep accommodating on a general-purpose internet-facing SSH service.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The mistake people make with Match blocks<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This matters, because a lot of blog posts get it wrong. You cannot use a normal <code>Match Address<\/code> block inside one <code>sshd_config<\/code> file to scope <code>KexAlgorithms<\/code> to a legacy source IP. That sounds neat, but it does not work the way people think.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Why? Because KEX happens before user authentication and before most of the post-handshake logic that <code>Match<\/code> is intended to control. The OpenSSH manual reflects that reality. <code>Match<\/code> allows a subset of keywords, and <code>KexAlgorithms<\/code> is not one of them. So if someone tells you to fix this with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Match Address 198.51.100.25\n    KexAlgorithms +diffie-hellman-group14-sha1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">that is not a real server-side fix.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is one of those details that only shows up when you actually test the thing instead of copying advice from generic SSH-hardening posts. The right scoped approach is different.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to scope legacy SSH compatibility properly<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you truly need to scope legacy support, you have two realistic options.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run a separate SSH listener on a dedicated IP or non-standard port with the legacy KEX exception.<\/li>\n\n\n\n<li>Keep the exception on the main listener only temporarily, and restrict source IPs at the firewall level while you replace the client.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The separate-listener pattern is cleaner. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># main sshd_config\nPort 22\nListenAddress 0.0.0.0\n\n# legacy instance on port 2222 or dedicated IP\n# separate config file, e.g. \/etc\/ssh\/sshd_config_legacy\nPort 2222\nListenAddress 203.0.113.10\nKexAlgorithms +diffie-hellman-group14-sha1\nPasswordAuthentication no\nPermitRootLogin no\nAllowUsers legacy-sftp-user\nSubsystem sftp internal-sftp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then pair that with firewall rules that only allow the partner IP or the specific office IP range to reach the legacy listener.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you cannot justify that extra cleanup work, be honest with yourself. What you are doing is not a surgical exception. It is a global weakening of the SSH service.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Validate with logs, not assumptions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the change is in place, test from both sides and watch the logs live.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>journalctl -u ssh -f\n\nssh -vvv user@server\nsftp -vvv user@server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">What you want to confirm:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The previous KEX failure disappears.<\/li>\n\n\n\n<li>The session now reaches authentication.<\/li>\n\n\n\n<li>SFTP subsystem startup is successful if the use case is file transfer.<\/li>\n\n\n\n<li>No new host key or cipher mismatch error replaces the old KEX error.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You should also inspect the effective server config, not just the file you edited.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sshd -T | grep -i kexalgorithms<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That command saves time. On busy systems with include files, automation, and panel tooling, what you think is active and what <code>sshd<\/code> is actually using are not always the same thing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What usually goes wrong after the first fix<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>You reloaded the wrong unit.<\/strong> Debian often uses <code>ssh<\/code>, not <code>sshd<\/code>.<\/li>\n\n\n\n<li><strong>You replaced the default KEX list instead of appending to it.<\/strong> Use <code>+<\/code> unless you deliberately want to override everything.<\/li>\n\n\n\n<li><strong>You enabled too many weak algorithms.<\/strong> That solves the ticket and creates a longer-term security problem.<\/li>\n\n\n\n<li><strong>You fixed KEX but ignored the next failure.<\/strong> Old clients often fail on host key or cipher negotiation immediately after KEX is restored.<\/li>\n\n\n\n<li><strong>You assumed Match could scope KEX.<\/strong> It cannot in the normal single-daemon way people describe.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A real-world operational insight here: the most dangerous version of this incident is not the outage. It is the quiet workaround that stays in place after the outage is over. Six months later nobody remembers why <code>group1<\/code> is enabled, and nobody knows which business process still depends on it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When to stop patching around the problem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the failing endpoint is a ten-year-old appliance, an abandoned desktop SFTP client, or an application nobody can update, then you are not solving an SSH problem. You are managing technical debt. At that point, the honest options are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>replace the client<\/li>\n\n\n\n<li>segment it behind a dedicated legacy listener<\/li>\n\n\n\n<li>move the workflow to a managed and controlled transfer path<\/li>\n\n\n\n<li>retire the dependency<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For teams that do not want to spend their week debugging post-upgrade SSH breakage, ServerSpan\u2019s <a href=\"https:\/\/www.serverspan.com\/en\/linux-administration\">Linux administration<\/a> service is built for exactly this class of production issue. If the underlying problem is bigger than one SSH daemon and you are already rebuilding or refreshing infrastructure, a clean <a href=\"https:\/\/www.serverspan.com\/en\/virtual-servers\">virtual server<\/a> deployment is often the faster path than layering exception after exception onto an aging node.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For related context, see <a href=\"https:\/\/www.serverspan.com\/en\/blog\/debian-13-trixie-is-now-available-on-enginyring-virtual-servers\/\">Debian 13 Trixie Is Now Available on Enginyring Virtual Servers<\/a> and <a href=\"https:\/\/www.serverspan.com\/en\/blog\/how-to-detect-intruders-in-your-vps-server-complete-security-guide\/\">How to Detect Intruders in Your VPS Server: Complete Security Guide<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A short recovery checklist<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Read the SSH logs and capture the exact client-offered KEX list.<\/li>\n\n\n\n<li>Add only the minimum legacy method needed, starting with <code>diffie-hellman-group14-sha1<\/code>.<\/li>\n\n\n\n<li>Validate with <code>sshd -t<\/code>.<\/li>\n\n\n\n<li>Reload the correct SSH service unit.<\/li>\n\n\n\n<li>Confirm the effective config with <code>sshd -T | grep kexalgorithms<\/code>.<\/li>\n\n\n\n<li>Retest with <code>ssh -vvv<\/code> or <code>sftp -vvv<\/code>.<\/li>\n\n\n\n<li>If the client still needs <code>group1<\/code> or more legacy concessions, move it to a dedicated listener or replace it.<\/li>\n\n\n\n<li>Document the exception and set a removal date.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">If you handle the incident that way, you fix the outage without turning one old SFTP client into a permanent server-wide downgrade.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If SSH or SFTP logins started failing right after an OpenSSH 10 upgrade, the usual cause is not your firewall, your users, or the SFTP subsystem. It is key exchange. OpenSSH 10 disables old finite-field Diffie-Hellman key exchange methods in sshd by default, so older clients suddenly fail with errors like Unable to negotiate with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2611,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,12],"tags":[14416,14420,14424,14426,14425,14427,14419,14422,14423,14417,14421,14418],"class_list":["post-2610","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-virtual-servers","tag-debian-13-openssh-10","tag-diffie-hellman-group14-sha1-fix","tag-legacy-sftp-client-fix","tag-legacy-ssh-kex-re-enable","tag-linux-ssh-compatibility-runbook","tag-managed-linux-administration","tag-no-matching-key-exchange-method-found","tag-openssh-10-legacy-ssh-fix","tag-openssh-10-no-matching-key-exchange-method-found","tag-openssh-10-sftp-compatibility","tag-ssh-key-exchange-troubleshooting","tag-sshd_config-kexalgorithms"],"_links":{"self":[{"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2610"}],"version-history":[{"count":2,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2610\/revisions"}],"predecessor-version":[{"id":2615,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2610\/revisions\/2615"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/2611"}],"wp:attachment":[{"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.serverspan.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}