Fast access to your ssh hosts

Fast access to your ssh hosts

As a developer or dev-ops you need to access many servers or hosts via ssh, usually you are doing this like the following:

ssh user@[IP/Domain] -p port -i PATH_TO_PRIVATE_KEY

There is a very easier way to do it like the following:

  • Open your ssh config file or create it if it doesn’t exist at: ~/.ssh/config
  • Add the following:
Host YOU_CAN_CHOOSE_ANY_NAME_YOU_WANT
        Hostname 1.1.1.1
        User root
        Port 22
        IdentityFile       ~/.ssh/private_key
  • You can remove IdentityFile or Port if it is not needed.
  • Save the file.
  • Now you can connect via ssh using the following command.
ssh MY_NEW_HOST_NAME

AHMED ELKHAYYAT
https://elkhayyat.me

I am a very keen individual that enjoys developing Python Programming Language. I have always loved computers and technology, ever since childhood. A team player who loves to work with other people on innovative projects and to take on challenges as an opportunity to grow as an individual in both a professional and personal capacity.

Leave a Reply

Select your currency
USD United States (US) dollar