Skip to content

How to create an SSH shortcut

In this post, I would like to show you a quick way to SSH into VMs. Using this approach you don’t have to type  ssh -i ..etc every time. 

Let’s open your ~/.ssh file and create a file called config and copy below shown text to it, 

Host app
    HostName ec2-xxxxx.us-east-2.compute.amazonaws.com
    User ubuntu
    Port 22
    IdentityFile ~/.ssh/arjunphp-app.pem

Host jenkins
Hostname ec2-xxxxx.us-east-2.compute.amazonaws.com
User ubuntu
IdentityFile ~/.ssh/arjunphp-jenkins.pem

If you get Permission denied issues,  change the file permission with below command:

 chmod 600 ~/.ssh/config

Sometime you might need to set  .pem file permissions to 600.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments