Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Fixing “no matching host key type found” When SSH from Ubuntu 24.04 to CentOS 6

Posted on 2025-11-192025-11-19 by Rico

When trying to SSH from Ubuntu 24.04 to a legacy CentOS 6 server, you may encounter the following error:

no matching host key type found. Their offer: ssh-rsa,ssh-dss

This happens because:

  • Ubuntu 24.04’s OpenSSH disables ssh-rsa and ssh-dss by default, as they are old and insecure.
  • CentOS 6’s OpenSSH (version 5.x) only supports ssh-rsa and ssh-dss, which Ubuntu no longer accepts.

In short:
👉 The new Ubuntu SSH client refuses the old CentOS 6 SSH server’s key algorithms.

This article summarizes several practical and safe ways to connect.


✅ Method 1: Temporarily enable ssh-rsa (recommended)

The safest and simplest one-time solution:

ssh -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa user@your-centos6-ip

✔️ No global changes
✔️ Secure for single-use


✅ Method 2: If the server only supports ssh-dss (DSA)

Some very old CentOS 6 systems may only offer ssh-dss:

ssh -oHostKeyAlgorithms=+ssh-dss -oPubkeyAcceptedAlgorithms=+ssh-dss user@your-centos6-ip

⚠️ DSA is deprecated and insecure. Use only when absolutely necessary.


✅ Method 3: Persistent configuration in ~/.ssh/config

If you frequently connect to this legacy host:

nano ~/.ssh/config

Add:

Host old-centos6
    HostName 192.168.x.x
    User user
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostKeyAlgorithms +ssh-rsa

Then:

ssh old-centos6

✔️ Applies only to this host
✔️ Keeps global system security intact


❌ Method 4: Modify system-wide SSH settings (not recommended)

sudo nano /etc/ssh/ssh_config

Add:

Host *
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostKeyAlgorithms +ssh-rsa

⚠️ This weakens security for all SSH connections, so avoid if possible.


🔍 If you also see cipher or key exchange errors

CentOS 6 uses outdated ciphers and KEX algorithms. If you see:

no matching cipher found

Try:

ssh \
  -oHostKeyAlgorithms=+ssh-rsa \
  -oPubkeyAcceptedAlgorithms=+ssh-rsa \
  -oCiphers=+aes128-cbc \
  -oKexAlgorithms=+diffie-hellman-group1-sha1 \
  user@ip

📌 Conclusion: CentOS 6 SSH is outdated and incompatible

CentOS 6 reached EOL in 2020, and its default OpenSSH is severely outdated.
Newer systems disable old algorithms, so issues like this are common.

Best practices:

  • Upgrade OS (best solution)
  • Or upgrade OpenSSH manually
  • Or use the temporary compatibility flags shown above for occasional access

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme