Skip to content

How to set default ssh key to log in to a server

Daisho Komiyama edited this page Jun 1, 2023 · 1 revision

I included the path for the ssh key every time I log in to the server.

ssh -i ~/.ssh/my_private_key_name my_user_name@192.xx.xxx.xxx

But once you run this command, your computer treats the ssh key as default.

The key is --apple-use-keychain, and as the name indicates, it only works for OSX.

ssh-add --apple-use-keychain my_private_key_name

After that, you won't need to include the path for the ssh key to log in to the server anymore.

ssh my_user_name@192.xx.xxx.xxx
Clone this wiki locally