Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

At my upcoming job i will handle many servers with SSH access. It will be like ~100-120 hosts, with different username on most of the hosts, and i'm pretty sure i will not remember each host domain name, not to mention which username is on each host.

Is there a tool for Mac OS X (Lion preferably) which would allow me to define a session for each host (in a session i mean username and some ssh options), show list of such sessions and connect on click/select automatically?

share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted

There are two ways I manage, or have seen people manage, SSH data:

Good 'ole, command line, plain text, ssh_config file.

Create a file called config inside ~/.ssh. You can specify global parameters by putting them above any host declarations. When I started using MacPorts, I had to explicitly define a default SSH Private Key to use automatically when connecting, so as the very first line of the file I put;

IdentityFile ~/.ssh/id_rsa

When you define custom rules for hosts (and you can even use * as a wildcard), it looks something like this:

Host prod-*
  User jason
  Port 2222
  LocalForward 5901 localhost:5901
  IdentityFile ~/.ssh/work-id_rsa

Then when I run ssh prod-script for example, all the rest of the rules get applied automatically.


A lot of people who don't want to manually manage all their stuff in such a cumbersome manner quickly find JellyfiSSH. (Mac App Store Link. The same people also became very annoyed when it stopped being downloadable for free.)

JellyfiSSH gives you GUI access to almost everything that can be specified in the command line or ssh_config file. JellyfiSSH is just a configuration storage app for organization purposes, because it generates the commands based off the options you set and upon clicking connect, opens a new terminal window with all of your options defined on the command line. JellyfiSSH is not a terminal app on it's own.

share|improve this answer
    
JellyfiSSH looks like app i was looking for. Thanks! –  bigfun Dec 30 '11 at 2:58
add comment

You can make files such as Example.command then make it executable: chmod 755 Example.command and double-click the file to open a connection:

#!/bin/sh

exec /usr/bin/ssh username@example.com

exit 0

If you just want to be able to connect from the command line using an alias (easy to remember word), you can set those up in ~/.ssh/config

Host foo
HostName some.really.long.hostname.here.com
Port 22
User bigfun

Then you can connect using the host foo

ssh foo

Or you can just make functions in your shell configuration file (~/.bashrc or ~/.zshenv):

s1 () {
    ssh -v username@example.com
}

then you can connect to example.com just by typing s1 at the command line, and it will use level 1 verbosity.

Lastly, you could use ssh auto-completion, but the syntax for that will depend on your shell of choice. A quick google for 'ssh autocomplete YourShellHere' should turn up some examples.

Use a passphrase and the OS X Keychain

The most important thing, IMO, is to setup ssh to work with a passphrase. OS X has great keychain integration built-in since Leopard.

ssh-keygen -t dsa -f ~/.ssh/id_dsa -C "you@exampledomain.com"

cat ~/.ssh/id_dsa.pub | ssh you@host.domain 'cat – >> ~/.ssh/authorized_keys'

(Source: http://www.paosborne.com/blog/?p=369.)

Then when you ssh to a new machine, the OS X keychain will prompt you for your ssh passphrase

See also http://www.dribin.org/dave/blog/archives/2007/11/28/ssh_agent_leopard/ for a fuller description. The article is older, but Lion works the same way.

Don't forget Dropbox

If you log into multiple machines, you can sync your ~/.ssh/config file via Dropbox. I keep mine in ~/Dropbox/etc/ssh/config.txt and then I do:

cd ~/.ssh
ln -s ../Dropbox/etc/ssh/config.txt config

I do the same thing as with my ~/.zshenv:

cd
ln -s Dropbox/etc/zshenv.sh .zshenv

In fact, I put all my shell scripts in ~/Dropbox/bin/ and added that to my $PATH too, just to cover all my bases.

share|improve this answer
    
Dropbox is a great place to store shell scripts that I don't want to manage in git / on GitHub. Thanks for sparking that 'aha' moment, TJ! –  Jason Salaz Dec 30 '11 at 18:58
add comment

You can try vSSH app for Mac OS X (PuTTY-based).

  • Manage connection list (host, port, username, password, keys and a lot of other settings)
  • Can almost everything that PuTTY can
  • Multi-tab multi-window interface
  • Macros support (you shell scripts as menu items for quick access)
  • iCloud synchronization (connections, macros and keys) with vSSH and SSH control apps for iOS

Available on the Mac AppStore.

share|improve this answer
    
Welcome to Ask Different! Please read the help center regarding self-promotion and include a disclaimer if you are the author of the product in your answer. –  George Garside Apr 24 at 14:45
    
How does this actually allow a clickable list of sessions? If you could edit out some of the generic marketing and focus this to the exact question at hand, it will likely get a better reaction. –  bmike Apr 24 at 18:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.