How to access and modify a SSH file on mac?

SwiftyJD picture SwiftyJD · Jan 10, 2019 · Viewed 24.9k times · Source

I'm trying to setup SSH on my computer but not sure how to access the ~/.ssh/config file. From github's website they mention this file has to be modified but I'm not sure where its located or how to modify it.

On Github:

If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

Answer

Mark Setchell picture Mark Setchell · Jan 10, 2019

Start Terminal and create the ~/.ssh directory if it doesn't exist:

mkdir -p ~/.ssh

Now go into the directory:

cd ~/.ssh

Now open the file config with the default editor:

open -t config

If it says that file doesn't exist, create it with:

touch config

and try opening again:

open -t config

When you edit the file, make sure it is "Plain Text" using the menu at the top of the screen and clicking Format->Make Plain Text.

Set the permissions as instructed in your tutorial.