linode-ssh-config

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2014 License: MIT Imports: 15 Imported by: 0

README

linode-ssh-config

Modifies your ~/.ssh/config file, preserving your exising entries, and appending your Linode hosts.

# Instead of connecting like
ssh ubuntu@my.linode.server.com -i ~/.ssh/linode-rsa
	
# Connect like this
ssh MyLinodeLabel

See Simplify Your Life With an SSH Config File for more information about ssh aliases and configuration options.

Download

Releases

Quickstart

  • Download the linode-ssh-config binary.

  • Create a Linode API key. (Click on my profile -> API Keys)

  • Create your linode-ssh-config config file, editing your API key and other variables.

cp linode-ssh-config.example.ini ~/.linode-ssh-config.ini

  • First test the output.

./linode-ssh-config

  • Make a backup of your exisiting ssh config

cp ~/.ssh/config ~/.ssh/config.bak

  • Update the ~/.ssh/config file.

./linode-ssh-config --update

Usage

The update command can be run repeatedly, as it replaces any previously generated configuration with the update configuration.

linode-ssh-config --update

Bash Autocomplete

To enable ssh autocompletion, add the following to your bash profile

# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh

Pretty Print

See a nicely formatted list of your linodes.

./linode-ssh-config --pp

Example output

# Existing config
Host devbox
  User vagrant
  IdentityFile ~/.ssh/vagrant.key

Host pi
  User pi
  StrictHostKeyChecking no

##### START GENERATED LINODE-SSH-CONFIG #####

## Production

Host Web1
        # Production | Linode ID 123456 | 1024m Ram
        Hostname 123.45.67.89
        IdentityFile ~/.ssh/linode-rsa
        User ubuntu

Host DB1
        # Production | Linode ID 765432 | 2048m Ram
        Hostname 111.11.111.11
        IdentityFile ~/.ssh/linode-rsa
        User ubuntu

## Staging

Host TestWeb1
        # Staging | Linode ID 112233 | 1024m Ram
        Hostname 128.11.11.11
        IdentityFile ~/.ssh/linode-rsa
        User ubuntu

Host TestDB1
        # Staging | Linode ID 765431 | 2048m Ram
        Hostname 111.11.111.12
        IdentityFile ~/.ssh/linode-rsa
        User ubuntu

##### END GENERATED LINODE-SSH-CONFIG #####

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL