Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Creating SSH Shortcuts

Creating SSH Shortcuts

0

I often have to SSH into different servers, either to deploy new code or to carry out maintenance, so SSH shortcuts are an easy way of making the login process easier. It means I can simply type ssh ServerName into Terminal to login to a remote machine. I use a the Terminal app on Mac to SSH into servers, so this tutorial covers how to setup SSH shortcuts on a Mac and Linux.

To get started, create a .ssh folder in your home directory (usually /Users/username on a Mac or /home/username on Linux) if it doesn’t already exist. Inside this directory, create a new file called config (with no extension). Then, we add our settings in the config like below:

If you use Private Key authentication, you can use the first example to specify the location of the key – remember, the correct permissions will need to be set on the key (I use chmod 600 ~/servername1.pem). The second example shows a connection that requires a password to be entered. Since the config file doesn’t let you store the password, connecting to this host will mean you have to enter the password manually everything.

Save the config file once you’re done, and you’ll easily be able to connect to your server using the Host you specified. In my examples, you can login using ssh ServerName1 or ssh ServerName2.

SSH Shortcuts

Linux, Mac OS, Server, SSH, Sysadmin, Tutorial

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Firewall Flash Gadget Geolocation Google Nexus 5 Hacking HTML5 iOS JavaScript jQuery Laravel 5 Linux NodeJS Parse PDF PHP Plugin Portfolio PS4 Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy