Adam Stacoviak changelog.com/posts

Ghost means never having to touch ssh/config again (either)

As a throwback to our original coverage of Ghost back in 2010, I wanted to share a hidden feature I just discovered in Ghost.

Two years ago Felipe Coury submitted a pull request to add ghost-ssh to manipulate ~/.ssh/config files. If it weren’t for Google pointing me to this pull request, I would have never known ghost-ssh existed. The readme says nothing about it!

This is what Felipe had to say when he submitted his patch:

I had a need to manipulate ~/.ssh/config file the same way I can manipulate my hosts entries, so I made this change.

Not sure if it will be useful for the upstream project, but be welcome to merge if you like.

An intro to ghost-ssh

Just like with ghost on the command line, ghost-ssh has basic list, add, and delete options, as well as an import operation to import files.

To save you some time, here’s the contents of ghost-ssh –help:

$ ghost-ssh --help
USAGE: ghost-ssh add <host> <hostname> [--user=<user>] [--port=<port>]
       ghost-ssh modify <host> <hostname> [--user=<user>] [--port=<port>]
       ghost-ssh delete <host>
       ghost-ssh list
       ghost-ssh empty
       ghost-ssh export
       ghost-ssh import <file>

An example of adding a new entry to your ssh/config might look something like this:

$ ghost-ssh add tclprod xxxxxx.gridserver.com --user=tcladmin
  [Adding] tclprod -> xxxxxx.gridserver.com

You can confirm the entry was added to ssh/config by running the ghost-ssh list command:

$ghost-ssh list                                             
Listing 1 configs(s):
  tclprod -> tcladmin@xxxxxx.gridserver.com:22

Now that I have this new entry in place, I can easily ssh into the server by running ssh tclprod and boom goes the dynamite!

Checkout the source for Ghost on GitHub for install and usage details.

Discuss on Hacker News if you’d like.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00