Pages

Subscribe:

Sunday, August 26, 2018

Creating a ssh config file so as not to pass the key or username in multiple servers

If you are running your servers in different VPC than based on the cidr range of the ip addresses and different username its difficult to remember all the keys  and username while connecting to the servers.



You can use an ssh config file to overcome this issue

Add the content below to the file ~/.ssh/config :
Host 10.0.6.* hostname* 
  user 
  IdentityFile ~//.ssh/id_rsa
  ProxyCommand ssh < firstname_employeeid>@54.254.*.*(public ip) nc %h %p
  ForwardAgent yes

Host hostname* 10.252.*.*
  ForwardAgent yes
  user 
  IdentityFile ~/< your laptop user >/.ssh/id_rsa
  ProxyCommand ssh @52.72.*.*(public ip) nc %h %p
Please fill your own usernames in the <> items above and public ip of your bastion host to connect to the server.

0 comments:

Post a Comment