Skip to main contentSkip to navigation
[email protected]
Client AreaSupport
Hosting Mammoth
HostingMammothYour Data, Our Responsibility
Home
Solutions
Hosting Services
Store
Pricing
About
Blog
API
Contact

Stay Ahead of the Curve

Get the latest insights on cybersecurity, AI innovations, and enterprise data solutions delivered to your inbox.

Hosting Mammoth
HostingMammothEnterprise Solutions

Enterprise-grade data solutions. Hosting, recovery, cybersecurity, and AI-powered services for businesses worldwide.

[email protected]
Sun - Fri, 9:00am - 5:00pm

Services

  • Cloud Hosting
  • Data Recovery
  • Cybersecurity
  • Legal Support
  • MSP Services
  • Web Development
  • AI Services
  • Free Server Migration

Hosting

  • VPS Hosting (NVMe SSD)
  • VDS Hosting (NVMe)
  • Storage VPS (High SSD)
  • GPU Servers
  • Managed Services
  • Cloud Firewall
  • Load Balancer
  • One-Click Apps
  • n8n Hosting
  • Object Storage
  • FAQ

Company

  • Store
  • Pricing
  • About Us
  • Locations
  • Blog
  • Testimonials
  • Contact
  • Affiliate Program
  • White-Label
  • Terms of Service
  • Privacy Policy
  • Browser Cookies
  • SLA

Support

  • Client Area
  • Submit Ticket
  • Knowledge Base
  • Server Status
  • API Documentation

© 2026 Hosting Mammoth. All rights reserved.

Knowledge Base
Getting StartedAccount ManagementVPS HostingGPU ServersStorage VPSCloud FirewallLoad BalancerServer ManagementBilling & PaymentsSupport & TicketsAffiliate ProgramReseller ProgramMarketplace & Appsn8n HostingManaged ServicesServer MigrationAPI & DevelopersSecurityTroubleshootingGlossaryInstall Guides
  1. Home
  2. /
  3. Support
  4. /
  5. Security
  6. /
  7. Ssh Key Security
GUIDESecurity

SSH Key Best Practices

4 min read

SSH keys are one of the most secure ways to authenticate with your server. However, improper key management can introduce vulnerabilities. This guide covers advanced best practices for generating, storing, rotating, and managing SSH keys to keep your Data Mammoth servers secure.

Use Strong Key Types

Always use modern, strong key algorithms:

Key TypeRecommendationCommand
Ed25519Recommended — fast, secure, small key sizessh-keygen -t ed25519
RSA 4096Good alternative for compatibilityssh-keygen -t rsa -b 4096
RSA 2048Minimum acceptablessh-keygen -t rsa -b 2048
ECDSAAcceptablessh-keygen -t ecdsa -b 521
DSADo not use — deprecated and insecure--
Generate an Ed25519 key:

bash
ssh-keygen -t ed25519 -C "[email protected]"

Protect Your Private Key

Use a Passphrase

Always set a strong passphrase when generating your key. The passphrase encrypts the private key file, so even if someone copies the file, they cannot use it without the passphrase.

bash
ssh-keygen -t ed25519 -C "[email protected]"

Enter a strong passphrase when prompted

Secure File Permissions

Private keys must have strict file permissions:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub
chmod 600 ~/.ssh/authorized_keys

If permissions are too open, SSH will refuse to use the key.

Never Share Your Private Key

  • The private key (id_ed25519) stays on your local machine.
  • Only the public key (id_ed25519.pub) is placed on servers.
  • Never email, message, or upload your private key.
  • Never commit private keys to version control.

Use an SSH Agent

The SSH agent holds your unlocked private keys in memory, so you only need to enter your passphrase once per session:

bash
# Start the SSH agent
eval "$(ssh-agent -s)"

Add your key

ssh-add ~/.ssh/id_ed25519

On macOS, you can add the key to the system keychain:

bash
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

One Key Per Purpose

Use separate SSH keys for different purposes:

KeyPurpose
id_ed25519_workWork server access
id_ed25519_personalPersonal projects
id_ed25519_cicdCI/CD pipeline
id_ed25519_clientClient server access
Configure your SSH client to use the correct key automatically:

text
# ~/.ssh/config
Host work-server
    HostName 203.0.113.10
    User deploy
    IdentityFile ~/.ssh/id_ed25519_work

Host personal-server HostName 203.0.113.20 User root IdentityFile ~/.ssh/id_ed25519_personal

Harden SSH Server Configuration

On your Data Mammoth server, configure SSH for maximum security:

bash
sudo nano /etc/ssh/sshd_config

Apply these settings:

text
# Disable password authentication
PasswordAuthentication no
ChallengeResponseAuthentication no

Disable root login

PermitRootLogin no

Use only SSH protocol 2

Protocol 2

Limit authentication attempts

MaxAuthTries 3 LoginGraceTime 30

Disable empty passwords

PermitEmptyPasswords no

Specify allowed users (optional)

AllowUsers deploy

Disable X11 forwarding (if not needed)

X11Forwarding no

Use only strong ciphers

Ciphers [email protected],[email protected] MACs [email protected],[email protected] KexAlgorithms curve25519-sha256,[email protected]

Restart SSH:

bash
sudo systemctl restart sshd

Warning: Test your configuration in a separate terminal before closing your current session. If misconfigured, use the web console to recover.

Key Rotation

Regularly rotate SSH keys to limit exposure from potential compromises:

Rotation Process

  • Generate a new key pair.
  • Add the new public key to your servers.
  • Test the new key.
  • Remove the old public key from servers.
  • Delete the old private key from your machine.
  • Recommended Rotation Schedule

    • Individual keys — Every 6 to 12 months.
    • CI/CD keys — Every 3 to 6 months.
    • After personnel changes — Immediately when a team member leaves.
    • After suspected compromise — Immediately.

    Audit Your Keys

    Regularly review who has access to your servers:

    bash
    # View all authorized keys
    cat ~/.ssh/authorized_keys

    Remove any keys you do not recognize or that belong to people who no longer need access.

    For managing SSH keys through the Data Mammoth dashboard, see Managing SSH Keys.

    What to Do Next

    • Managing SSH Keys — Add and remove keys via dashboard.
    • Server Firewall Hardening Guide — Complement SSH security with firewall rules.
    • Complete Server Security Checklist — Full security review.
    • Enable 2FA — Protect Your Account — Secure your dashboard access.

    Was this article helpful?

    ← Back to SecurityBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket