Docs / Linux Basics / How to Use SSH Config for Managing Multiple Servers

How to Use SSH Config for Managing Multiple Servers

By Admin · Feb 25, 2026 · Updated Apr 24, 2026 · 159 views · 1 min read

The SSH Config File

Instead of remembering IP addresses and usernames for every server, use the SSH config file to create shortcuts.

Create the Config

Edit ~/.ssh/config:

Host web-server
    HostName 198.48.63.241
    User deploy
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Host db-server
    HostName 198.48.63.242
    User admin
    Port 2222
    IdentityFile ~/.ssh/db_key

Host staging
    HostName 67.231.246.194
    User root
    IdentityFile ~/.ssh/staging_key
    ForwardAgent yes

Usage

# Instead of:
ssh -i ~/.ssh/id_ed25519 -p 22 deploy@198.48.63.241

# Just type:
ssh web-server

Useful Options

OptionPurpose
HostNameServer IP or domain
UserLogin username
PortSSH port
IdentityFilePath to private key
ForwardAgentForward SSH agent (for git through jumpbox)
ProxyJumpJump through a bastion host
ServerAliveIntervalKeep connection alive

Wildcard Patterns

# Apply settings to all hosts
Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3
    AddKeysToAgent yes

# Apply to hosts matching pattern
Host prod-*
    User deploy
    IdentityFile ~/.ssh/prod_key

Jump Hosts

Host bastion
    HostName 198.48.63.240
    User admin

Host internal-server
    HostName 10.0.0.5
    User deploy
    ProxyJump bastion
# Connects through bastion automatically
ssh internal-server

SCP and rsync

SSH config aliases work with all SSH-based tools:

scp file.txt web-server:/var/www/
rsync -avz ./dist/ web-server:/var/www/html/

Was this article helpful?