Easy ssh configuration with .ssh/config file

2011-04-11 202 words 1 min read

If you ssh to many hosts then you are aware of the pain that it takes to ssh with different username and hostname. There is an alias that you can creat with native ssh though. Here I will show you the same with an example.

  <td>
    <div class="text codecolorer">
      cat <<EOF >>~/.ssh/config<br /> Host <alias><br /> Username <user name><br /> Port <port number><br /> Hostname <hostname>
    </div>
  </td>
</tr>
1
2
3
4
5

You can optionally omit the parameters that you do not require explicitly. For example, if your port number is default then you can simply ignore the parameter.

Once this is done, you can simply ssh with the alias name, for ex:

  <td>
    <div class="text codecolorer">
      ssh <alias>
    </div>
  </td>
</tr>
1

Note: Remember to change the mode of the config file to “644” if the file does not exist already.

 

Add this with the key authentication for ssh and you have a password-less alias based ssh setup 🙂

Enhanced by Zemanta

Related Articles:


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it