Chapter 7. SSH Remote Connection

Locate .ssh Directory

Locate .ssh Directory
Tag:

Understanding the .ssh directory on your local computer is important for starting SSH remote login. Usually, key pairs, the established host information document, and the configuration document are saved under this directory.

Location of .ssh directory

The .ssh directory is located under your home directory.

mac.svg The .ssh directory is hidden on Mac. In order to display the directory, you need to press the ⬆︎ shift + ⌘ command + . keys on Mac OS.

Key files under .ssh directory

Initially, no file is located in this directory; however, there are three types of important files that will be created under this directory.

key files

In the case of key pair generation (public key and secret key), usually, the key pair is generated in this directory unless you specify another path when generating the key pair. The default file names for RSA (a type of encryption technology) are id_rsa (secret key) and id_rsa.pub (public key). You can change the name of the key pair to manage multiple key pairs.

Also, when you download a private key from a server or cloud service, usually, you'll usually save the key under this directory. The key file type can be different from the type of the key file you generate on your computer. e.g., xxx.pem

config file

The config file is very useful. You can write multiple SSH configurations so that you can build quick access to each SSH server with a simple command. How to write the config file will be explained later.

known_hosts

The known_hosts file is an auto-generated file. Once you establish a new SSH remote connection, the public key information is recorded in this file and it is used for the authentication process afterwards.

Understanding the .ssh directory on your local computer is important for starting SSH remote login. Usually, key pairs, the established host information document, and the configuration document are saved under this directory.

Location of .ssh directory

The .ssh directory is located under your home directory.

mac.svg The .ssh directory is hidden on Mac. In order to display the directory, you need to press the ⬆︎ shift + ⌘ command + . keys on Mac OS.

Key files under .ssh directory

Initially, no file is located in this directory; however, there are three types of important files that will be created under this directory.

key files

In the case of key pair generation (public key and secret key), usually, the key pair is generated in this directory unless you specify another path when generating the key pair. The default file names for RSA (a type of encryption technology) are id_rsa (secret key) and id_rsa.pub (public key). You can change the name of the key pair to manage multiple key pairs.

Also, when you download a private key from a server or cloud service, usually, you'll usually save the key under this directory. The key file type can be different from the type of the key file you generate on your computer. e.g., xxx.pem

config file

The config file is very useful. You can write multiple SSH configurations so that you can build quick access to each SSH server with a simple command. How to write the config file will be explained later.

known_hosts

The known_hosts file is an auto-generated file. Once you establish a new SSH remote connection, the public key information is recorded in this file and it is used for the authentication process afterwards.

Tag: