Are you typing something like this when you log in to a server via SSH from your PC?
$ ssh hoge@server_name -p 22 -i ~/.ssh/key_name
By using a .ssh/config file, you can SSH with much less typing, like this:
$ ssh srv
Now, let’s get it configured!
Steps
Edit your .ssh/config file.
$ vi ~/.ssh/config
Configure the following settings:
Host srv # SSH alias / SSH host nickname
User hoge # Login username
HostName server_name # Server hostname
Port 22 # Port number to use
IdentityFile ~/.ssh/key_name # Specify the private key (not required for password authentication).
Now, all you have to do is SSH.
$ ssh srv
It’s that simple!
Once you set it up, you can SSH with much less typing. I highly recommend everyone give it a try!

コメント