Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Latest commit

 

History

History
105 lines (88 loc) · 3.43 KB

README.rdoc

File metadata and controls

105 lines (88 loc) · 3.43 KB

Introduction

A CLI utility to bookmark ssh connections with hierarchy and act upon these bookmarks. Currently only opens a shell.

Installation

You must have ruby and rubygems installed and then run: gem install runssh

Bash Completion

For bash completion I added a simple runssh_comp.sh file which completes the subcommands and the paths, but not the arguments. To use it, just copy it from your gem’s bin directory to /etc/bash-completion.d/ (or wherever your bash-completion scripts are).

Zsh Completion

For zsh - Until I’ll write a proper zsh completion file - I’m using bashcompinit to use the bash completion script. To use the bash completion file with zsh, copy the file to some place and switch the comments between line 14 and 15. Then add the following to your .zshrc file: autoload bashcompinit bashcompinit source /path/to/modified/runssh_comp.sh This works for me, but I’m only starting with zsh so I hope it will work for you as well.

Usage

For usage run runssh without arguments.

Host Definition

Host definition is a collection of attributes that help us define a host bookmark. As of version 0.1.0 only hostname and remote user are supported, but more attributes (e.g, tunnel definition) will be added on later versions.

Bookmarks

The bookmarks consists of a host definition inside nested groups. These groups could hold other groups or host definitions. Here is an example of bookmarks:

customer1:
    location1:
        host1
        host2
    location2:
        host3
        host4
        sublocation:
            host5
customer2:
    office:
        host1
        ...

You can decide to arrange your bookmarks by customers and/or location and/or internal/external addresses etc. To access a host definition you specify the full path to that host. In the above example to access host2 (e.g, print it’s definition) run:

runssh print customer1 location1 host2

requirements:

Dependencies (runtime and development) are specified in runssh.gemspec. When installing through gem, dependencies will be installed by default. For development, you need to install bundler 1.0.x and run (inside the project directory):

bundle install

License

This program is distributed under the GPL v2 license.

History

0.1.0

  • Initial release. Simple bookmarks (host and user),only shell operation supported.

0.1.1

  • Improved docs.

0.2.0

  • New config file structure - with config file version discovery and update.

  • Some output improvements.

  • Added support for remote commands.

  • Rewrite of some of the elements. The next release will introduce further rewrite.

  • Added support for ruby 1.9.2.

0.2.1

  • Fixed docs.

0.2.2

  • Enabled overriding hostname when invoking shell (Could be used to bookmark a host with changing addresses - e.g. in EC2)

  • Enabled definition of (local) ssh tunneling. Currently only in the shell command.

TODO

  • Refactor of RunSSHLib::CLI to avoid repetition of so many options between add, update and shell.

  • Create a proper zsh completion script.

  • Add scp capabilities

  • Add support for bookmarking tunnels

  • Shell via gateway (connect to a firewall and from there open shell to the host).

  • Rename (or move) host definition

  • Maybe replace invoking ssh from the command line with some library.

  • Automatic deletion of empty groups.