Skip to content

SSH Config Generator

Name each server once. Then connect with ssh and a short alias.

Free · No signupBuilt in your browser

Start from

Host 1 of 1

The name you type after ssh. Separate several names with spaces; * matches anything.

Connection

Leave blank when the alias is already the real address.

Your login on the server.

Blank uses 22.

Key

The private key file, without .pub. Paths with spaces are quoted for you.

Offer just this key. Avoids “Too many authentication failures”.

Enter the key’s passphrase once per session.

Route

Reach this host through a bastion: another alias or user@host:port.

Lets this server use your local keys for onward SSH. Trusted hosts only.

More options Keepalive, host keys, any directive

Seconds between checks. Stops idle drops.

Unanswered checks before SSH disconnects.

What SSH does with a host key it has not seen.

Helps on slow links; slower on fast ones.

Any other ssh_config directive, added to this host as written.

1 host
Host web  HostName 203.0.113.10  User deploy  IdentityFile ~/.ssh/id_ed25519  IdentitiesOnly yes

Then connect with

  • ssh web

More servers than you can remember

Save your servers in CtrlOps instead.

Connect with keys, a password or a pasted connection string, and manage every server from one local desktop app.

Connect your first serverDownload for MacDownload for Windows

Keep it handy

The directives
you will use most.

Each line in a host block is a directive and a value. Names are not case-sensitive, and SSH ignores blank lines and lines that start with #.

Common SSH config directives, what they do and an example value
DirectiveWhat it doesExample
HostStarts a block. The alias or patterns that block applies to.Host web
HostNameThe real hostname or IP address the alias connects to.HostName 203.0.113.10
UserThe login name, so you can drop user@ from the command.User deploy
PortThe SSH port on the server. Leave it out to use 22.Port 2222
IdentityFileThe private key to offer for this host.IdentityFile ~/.ssh/id_ed25519
IdentitiesOnlyOffer only the IdentityFile key, not every key in your agent.IdentitiesOnly yes
AddKeysToAgentAdd the key to your running agent after first use, so the passphrase is asked once.AddKeysToAgent yes
ProxyJumpConnect through a bastion or jump host first.ProxyJump bastion
ForwardAgentLet the server use your local agent for onward SSH. Trusted hosts only.ForwardAgent yes
ServerAliveIntervalSeconds between keepalive messages, so idle sessions stay open.ServerAliveInterval 60
ServerAliveCountMaxUnanswered keepalives allowed before SSH drops the connection.ServerAliveCountMax 3
StrictHostKeyCheckingWhat SSH does with unknown or changed host keys.StrictHostKeyChecking accept-new
CompressionCompress traffic. Helps on slow links only.Compression yes

How SSH reads it

First match wins.
Order matters.

What the SSH config file does

~/.ssh/config saves connection settings per host, so a command like ssh -i ~/.ssh/id_ed25519 -p 2222 deploy@203.0.113.10 becomes ssh web. The same aliases work for scp, rsync, git and anything else built on OpenSSH.

Specific hosts first, defaults last

SSH checks every Host block from top to bottom. When several match, it merges them, and for each option it keeps the first value it read. That is why a Host * block of shared defaults belongs at the end: anything you set for a specific host above it still wins.

Patterns and wildcards

A Host line can list several names, separated by spaces. * matches any characters and ? matches one, so Host *.internal covers every internal hostname. Start a pattern with ! to exclude a host.

Save it with the right permissions

Copy the install command to create ~/.ssh if needed, keep a backup of your current file, append the new hosts and set chmod 600. Prefer to do it by hand? Download the file, move it to ~/.ssh/config and set the same permissions. The chmod calculator explains what 600 and 700 allow.

Test before you connect

ssh -G web prints the final settings SSH would use for web without connecting. Need a key for IdentityFile first? Create one with the SSH key generator.

Read the OpenSSH ssh_config reference

Before you save

SSH config,
explained.

Where is the SSH config file located?

The per-user SSH config file lives at ~/.ssh/config on macOS and Linux, and at C:\Users\<you>\.ssh\config on Windows with the OpenSSH client. System-wide defaults are stored in /etc/ssh/ssh_config. If the ~/.ssh directory does not exist yet, create it before adding the file.

What is the difference between Host and HostName?

Host is the alias you type after ssh - for example "ssh myserver". HostName is the real address that alias points to, such as an IP like 192.0.2.10 or a domain. This lets you connect with a short, memorable name instead of the actual hostname.

How do I use multiple SSH keys for different hosts?

Add a separate Host block for each server and set its IdentityFile to the correct private key. Enable IdentitiesOnly yes so SSH uses only that key rather than offering every key in your agent, which prevents "too many authentication failures" errors on servers that limit attempts.

What does ProxyJump do?

ProxyJump tells SSH to connect through an intermediate bastion or jump host before reaching the target server. For example, ProxyJump bastion routes the connection through the host aliased "bastion" first. It replaces the older, more verbose ProxyCommand with netcat approach.

How do I set the correct permissions on the SSH config file?

Run chmod 600 ~/.ssh/config so only your user can read and write it, and chmod 700 ~/.ssh on the directory. OpenSSH rejects a user config file with an incorrect owner or permissions that let other users write to it. You can use our chmod calculator at /tools/chmod-calculator to see exactly what those values mean.

Does the order of hosts in the config file matter?

Yes. For each setting, SSH uses the first matching value it finds reading top to bottom. Put specific Host entries before broad wildcard entries (like Host *) so the specific settings win. The generator outputs your hosts in the order you add them.

Keep exploring

Tools and guides for your next step.

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy