Globally set SSH credentials and login with a single command
To deploy application we had to log in to remote server regularly. Especially, those who are working on cloud-server like AWS and Google Cloud. SSH is a very known term to them.

It is easier to access a server’s computer from your personal computer through SSH. Secure Shell (SSH) is a protocol. Using that protocol you can easily get access to use another computer remotely. And you can run command in that computer. You can deploy your applications and so on so forth.
If you want to use another computer or server you must have access to that. And for the access, you have to have some credentials that have to be verified by that computer or server. After successfully verification the computer/server gives you an environment in the terminal which through you can access that computer/server.
What are the credentials you need to login into computer/server through SSH?
- IP address of the computer/server
- Username
- Fingerprint file/Password
The fingerprint is based on the Host’s Public key,.Generally its for easy identification/verification of the host you are connecting to. You don’t need password if you are using fingerprint file (.pem or .pub). You can get this file from your computer/server.
Suppose, we have all the credentials. Now, how we can log in into computer/server through SSH?
ssh -i fingerprint.pem username@192.168.0.121
You can easily get access to your computer/server by the command above.
Suppose, you have a bunch of computer/server you are working on a daily basis. And every computer/server has different IP addresses and fingerprint files. You need to log in into those servers frequently. Now, how you can remember all these credentials every time or does it mandatory!
No!!! you don’t need to keep those credentials in your mind always. And also you don’t need to search for previous command in your terminal also 😜
But, how can you get rid out of remembering those?
Yes! there is a global ssh config file to help you. You can generate a global config file for all of your servers you are working on. In that file, you will set your server name and significant credentials for the server.
To generate config file run the command below in your Ubuntu PC
For windows user: go to this directory C:\Users\YourUser\.ssh\ and create a file named config without any file format. And open it in editor
nano ~/.ssh/config
You will see an editor with an empty line. Now, there you should set your server name and stuff.
Host prod
IdentityFile D:/aws/prod.pem
HostName 172.163.1.12
User newuserHost dev
IdentityFile D:/aws/dev.pem
HostName 172.163.1.12
User ubuntu
I have created two sample server. One is prod and another is dev. For every server, I have pointed a signature file and IP address of the computer/server and username.
Now, If you want to log into production server. Just simply run the command below:
ssh prod
Hurrah! You did it. This is how you can improve your productivity by saving your valuable time from remembering shit.
Thank you so much for reading this patiently.