DEV Community

Catalin Ion
Catalin Ion

Posted on

Saved ssh configuration to quickly connect to servers

Originally posted on catalinxyz.com

When working with servers and you have to connect through ssh multiple times it can be cumbersome to write ssh user@255.255.255.255 every time. We can save the connection details in the ssh config and simply run ssh serverName

Edit or create the config file if it doesn't exist

~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

Add a connection and save

Host {name}
    HostName {server_ip}
    User {username}
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_name
Enter fullscreen mode Exit fullscreen mode

To connect run

ssh {name}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)