SSH Config File
The config file for SSH is an extremely useful tool to speed up the SSH remote login process. By writing the following information in the config file, you can shorten the SSH command.
STEP 1. Describe SSH remote login key information in the config file under the .ssh directory
Describe the following information in the config file. If the config file doesn't exist, you can create a new one.
Host
(SSH name): you can use any name to call the SSH configurationHostname
: public IP address of the server that you want to connect toUser
: user name of the serverIdentityFile
: full path of the private key file for SSH remote login
STEP 2. Run SSH command
Run the SSH command with the name you created
ssh [ssh name]
Practice
If you don't have the config file yet, create it in the .ssh directory. For Windows Powershell, use the New-Item
command instead of the touch
command.
cd ~/.ssh
touch config
Open the file and add the necessary information like below.
Host ssh_test
Hostname 18.143.143.190
User ubuntu
IdentityFile ~/.ssh/id_rsa
After saving the file, run the following command.
ssh ssh_test
The command line may ask the passphrase if you set one. After typing the passphrase you set, you can establish an SSH connection. If you didn't set a passphrase, an SSH connection will be established right away.