entbit. Menu

Cologne, DE

Published
Length
1 min · 179 w
Filed under
macOS

Configure SSH for a specific Host.

Software engineering enthusiast from Cologne, Germany. Writing about DevOps, Containers, Cloud, Deno, books and everything else that interests me.

I had to set up an Ubuntu machine a couple weeks back and set up a fresh git server at work. To get rid of the authentication every single push and pull I set up ssh keys to authenticate that way. This post is also a reminder for me to find a quick config to use.

Example

With the following ssh-config the ssh client will open a ssh connection with only typing ssh example. The user that is used then is niklas. Otherwise you would have to write ssh -i ~/.ssh/example.key niklas@example.com. If this is a connection you have to connect to more often this is can be a waste of effort. Just simply open your ssh-config with nano ~/.ssh/config and use the following config:

Host example
	HostName example.com
	User niklas
	IdentityFile ~/.ssh/example.key

Copy specific key with ssh-copy-id

ssh-copy-id -i path/to/key user@host

This command will easily transfer your public key to the authorized_keys on your server.

Thanks for your time,
Niklas

Newsletter · entbit.

One email per post.

Deno, AWS, GitHub Actions and whatever I'm debugging. No spam.

Prefer not to hand over your real address? Use an alias from DuckDuckGo, Firefox Relay or Hide My Email.