SSH Config Generator

Generate ~/.ssh/config entries for managing multiple servers. Set host aliases, usernames, ports, identity files, keep alive, jump hosts, port forwarding, and more — all in one place.

Ad Space

How Does the SSH Config Generator Work?

The SSH Config Generator is a free online tool that helps developers, system administrators, and DevOps engineers create properly formatted SSH configuration blocks for the ~/.ssh/config file. Instead of manually writing config entries and risking syntax errors, you can fill in the fields and get a ready-to-use config block that you simply paste into your config file.

The SSH config file is one of the most powerful yet underused features of OpenSSH. It lets you define shortcuts for servers you connect to frequently, so instead of typing ssh -i ~/.ssh/id_ed25519 -p 2222 [email protected] every time, you can simply type ssh production-server. The config file supports dozens of directives that control connection behavior, authentication, tunneling, and proxy settings.

Why Use an SSH Config File?

Managing multiple servers without an SSH config file means remembering hostnames, ports, usernames, and key paths for every connection. This quickly becomes unmanageable when you work with staging, production, database, and bastion servers across multiple projects. An SSH config file centralizes all connection details in one place. It also enables advanced features like jump host proxying, where you connect through a bastion server to reach internal hosts, and local port forwarding, which lets you securely access remote services like databases through an SSH tunnel.

SSH Config Directives Explained

Each SSH config block starts with a Host directive that defines the alias you will use to connect. The HostName directive specifies the actual server address (IP or domain). User sets the login username, and Port overrides the default SSH port 22. The IdentityFile directive points to the private key used for authentication. Additional directives like ServerAliveInterval prevent dropped connections, ProxyJump enables bastion host access, and LocalForward creates SSH tunnels for port forwarding.

Best Practices for SSH Config

Common Use Cases

Teams commonly use SSH config files for managing cloud instances on AWS EC2, DigitalOcean, and Google Cloud. The config file is also essential for Git operations over SSH when you have multiple GitHub or GitLab accounts, as you can assign different identity files to different host aliases. CI/CD pipelines, Ansible playbooks, and deployment scripts all benefit from well-organized SSH configs that abstract away connection details into simple aliases.

Frequently Asked Questions

Where is the SSH config file located?

The SSH config file is located at ~/.ssh/config on macOS and Linux. On Windows with OpenSSH, it is at C:\\Users\\YourName\\.ssh\\config. If the file does not exist, you can create it manually. Make sure to set its permissions to 600 (read/write for owner only) using chmod 600 ~/.ssh/config.

What is a bastion host or jump host in SSH?

A bastion host (also called a jump host) is a server that acts as a gateway between your local machine and internal servers that are not directly accessible from the internet. You SSH into the bastion first, and then it forwards your connection to the target server. The ProxyJump directive in SSH config automates this so you can connect with a single command.

What does ServerAliveInterval do in SSH config?

ServerAliveInterval tells your SSH client to send a keep-alive packet to the server every N seconds (e.g., every 60 seconds). Combined with ServerAliveCountMax, it prevents your connection from being dropped due to inactivity. If the server does not respond after the specified number of keep-alive attempts, the connection is closed cleanly.

Can I use multiple SSH keys for different servers?

Yes. The IdentityFile directive lets you specify a different private key for each Host block in your SSH config. This is commonly used when you have separate keys for work and personal accounts, or different keys for different cloud providers. Each host alias can point to a different key file.

What is SSH local port forwarding?

Local port forwarding creates an encrypted tunnel from a port on your local machine to a port on a remote server. For example, LocalForward 3306 localhost:3306 lets you access a remote MySQL database on localhost:3306 through the SSH tunnel. This is useful for securely accessing databases, web admin panels, or other services that are not exposed to the internet.