Create SSH Bookmarks in Terminal for Quick Remote Server Access in Mac OS X
Setting up SSH bookmarks within Terminal app is an easy way to quickly connect to remote machines. If you haven’t noticed these in Terminal before it’s probably because they aren’t labeled as bookmarks, and therefore the feature gets frequently overlooked by even the most advanced Mac users. Here’s how to create bookmarks within Terminal, and also two quick ways to access any of those bookmarks from just about anywhere in Mac OS X.
Setting SSH Bookmarks in Terminal
This guide is intended for SSH but it would also work for Telnet:
- Launch Terminal (/Applications/Utilities/ folder)
- Pull down the “Shell” menu and choose “New Remote Connection”
- Choose SSH on the left side, then click the [+] plus icon to add a new server bookmark
- Enter the IP of the server – Important note: if you use a custom port and username enter those in the URL field as the following syntax: “-p port user@host.com”
- Click “OK” and you’ll find the standard command line syntax for connecting to an SSH server is printed in the connection window
- Click “Connect” and away you go, using the custom port and username you specified
For example, if I use port 24 and the username “dude” for server3.osxdaily.com, the syntax would be: “-p 24 dude@server3.osxdaily.com”
You’ll notice we ignored the “User” field in this example because we set a custom port. If the server you are connecting to uses the default port 22 (like the OS X SSH server does) you won’t need to do this.
2 Ways to Quickly Access Terminal Bookmarks
Now that a bookmark has been created, quickly access the bookmarks from just about anywhere using these two methods:
- From Terminal, hit Command+Shift+K to open the New Connection window
- From anywhere in Mac OS X, right-click on the Terminal Dock icon and choose “New Remote Connection”
Both of these will bring up the connection window where the bookmarks reside. Connecting to a bookmark will request a password unless you have SSH keys set up for passwordless logins.
If you live and breathe in the command line you’ll likely find that making SSH shortcuts with aliases is a faster method to access any frequently used server, however.
I would like to start terminal at login and have it not start a terminal shell session but rather the “New Remote Connection” menu. Is this possible?
I’ve been looking for a way to bookmark SSH commands and eventually I developed a Mac app for our team, called TaskTips (https://task.tips/). Basically it can save you time by indexing your SSH commands, and autocomplete when you search SSH tasks, executing tasks automatically.
If it is also helpful for someone else, I would be really happy about it.
If you want you can backup ssh settings into the .ssh/config file and this will also allow you to create “shortcuts” for ssh connexion.
Example: put the following lines in .ssh/config
Host osxd
Hostname server3.osxdaily.com
Port 24
User dude
and by typing “ssh osxd” in the terminal you will now be able to connect to your server.
Great tip for accessing linux servers. Question, how do you backup these settings?
They are stored in plist as prefs. Noy really a backup tho.