• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 14 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Tool to help manage your .ssh/config file.

ssh-config: A Tool for Managing ssh Config Files

Overview

It’s not THAT much trouble to update your .ssh/config file every time a host changes, but when it starts happening often enough, even that hassle starts to add up. This is a quick tool I wrote to help handle them.

It takes great care to not trash your config file, so you can continue to edit your config files by hand before and after running the tool.

ssh-config will make a backup of your ~/.ssh/config file as ~/.ssh/config~.

Probably the most useful command is “copy”, which intelligently copies an existing host section.

Commands

set <host> <key> <value>

Adds or updates the value for a given host.

unset <host> <key>

Removes a key value for a given host. NOTE: If all values are removed from a section, the section is NOT removed; use rm <host> for that.

rm <host>

Removes an entire host section.

copy <old_host> <new_host> [<key> <value> […]]

Copies the entire section named <old_host> to a new section called <new_host>. If old_host has a Hostname section, ssh-config will try to update it to reflect the new_host name. For example, if you had a section like

Host rails01
  Hostname rails01.example.com

And you did ssh-config copy rails01 rails02, the new section would look like this:

Host rails02
  Hostname rails02.example.com

You can manually override any setting, and/or set new ones by appending the new key/value pairs at the end. Given the rails01 section above, “ssh-config copy rails01 rails02 Hostname rails-02.example.com User dbrady” would emit

Host rails02
  Hostname rails-02.example.com
  User dbrady

Note: If you just want another short name for a host, use alias instead

dump

Dumps the entire file.

show <host> [<host> …]

Dumps one section. (Similar to ssh-what.) <host> may be the main name for a host or an alias.

search <pattern>

Shows all sections that have any line (key OR value) that matches pattern. (Similar to ssh-what.)

list

Lists all section names (just the Host line)

alias <host> <alias> [<alias> …]

Adds one or more aliases to a host definition (to show up on the Host line).

unalias [<host>] <alias> [<alias> …]

With 2 or more arguments, looks up host by <host> (must be the first name on the Host line), and removes any <alias>es from the list of alternate names. With only 1 argument, looks for an entry by that alias (must NOT be the first name on the Host line), and removes the alias from the entry, if found.

More Repositories

1

tourbus

Website load testing tool in Ruby, with the ability to "unload a busload of tourists" on a website, each with the ability to trace through complex application paths.
Ruby
266
star
2

ligament.js

Backbone.js extension that connects backbone models with relational associations.
JavaScript
125
star
3

scrapbin

Random code fragments and tools.
Ruby
26
star
4

migratrix

Rails migration tool supporting multiple migration strategies
Ruby
24
star
5

scoped_attr_accessor

Adds private and protected attr_accessor methods to your classes--or to all of ruby.
Ruby
12
star
6

pally

Your friendly helpful Command-Line Interface to Rally
Ruby
7
star
7

dijkstra

Rubygame animation visualizing Dijkstra's Minimum Spanning Tree algorithm
Ruby
6
star
8

euler

My Project Euler solutions. Don't peek until you have worked Project Euler for yourself!
Ruby
6
star
9

polyhedra

Polyhedral RPG Dice DSL and Rolling Tool
Ruby
6
star
10

geocode

Ruby library and CLI tool to geocode and reverse geocode.
Ruby
6
star
11

rspec-junklet

Works like rspec let but easily creates unique junk data
Ruby
5
star
12

twitterlost

Keep track of your twitter followers, see who has unfollowed you. Sadly it will not tell you why (but it was probably because of something you did)
5
star
13

rubyamf

Port of RubyAMF, with maintenance updates I need
Ruby
4
star
14

bin

My personal bin folder. I keep ~/bin in my path; these are the utilities and scripts I keep in there.
Ruby
4
star
15

ruby3d

Basic 3D math library in Ruby
Ruby
4
star
16

fakemail

A test helper for faking email sending
3
star
17

sinfile

Sinatra File Server - A simple http file server.
Ruby
3
star
18

pants

Sinatra-based blogging engine. Low-bloat, low-feature count.
Ruby
3
star
19

mandelbrot

Ruby script to generate mandelbrot fractals
Ruby
3
star
20

teensy

Common repo for my Atmel AVR "Teensy" projects
C
3
star
21

sqladvent

Adventure Game... Written in SQL
Ruby
2
star
22

poodle

Poopworthy(TM) Drawing Language
Ruby
2
star
23

idest

Id Est: "That Is". Estimation tracking tool.
Ruby
2
star
24

chdk

Random CHDK scripts and programs for programmable Canon cameras
Visual Basic
2
star
25

acts_as_partial_finder

Lightweight partial finder for Rails. Simple finder methods that search string fields using LIKE %arg%.
Ruby
2
star
26

libxml

A tweaked version of the standard version of libxml that has had references to stderr removed, eliminating clutter in tests and specs in other projects.
2
star
27

speccle

Custom RSpec runner with iTerm coloring
Ruby
2
star
28

xmlvalidate

Tool to validate XML documents against an XSD schema
2
star
29

throbby

Atmel "Teensy" AVR90USB program to "throb" the onboard LED by changing duty cycle.
2
star
30

midiq

Silly message queueing demo using MIDI.
Ruby
2
star
31

ratpack

Linux Service for starting and stopping Sinatra apps
2
star
32

dotfiles

My configuration and other dotfiles
Emacs Lisp
2
star
33

switchy

Ruby application to switch AC power loads via USB Serial driver and a Teensy dev board (Atmel AVR at90usb162)
C
2
star
34

myip

A simple web app to show visitors their IP address. Written because the major site I used to use for this has made the IP address not copyable without clicking on their ads.
2
star
35

refdox

Reference Documentation, Notes and Cheatsheets I want on every machine I use
Ruby
2
star
36

mixtures

Data management app for composing sample data sets out of sql databases.
2
star
37

kk

Personal diary/journaling/logging tool
Ruby
2
star
38

spinny

Nanoapp in Rubygame that spins a node graph as you create it. Demonstrates framerate-independent animation and visualizes the (n**2-n)/2 cost of fully interconnecting a graph.
Ruby
2
star
39

phaser_tower

Tower Defense game made with with Phaser.io. Learning project. Set expectations to "low". No, lower than that. Still lower. Keep going... okay, stop. That's about right.
JavaScript
1
star
40

cheatsheets

Collection of cheatsheet documents and reference scripts
1
star
41

echoserver

Sample Echo Server using Sinatra-Websocket
Ruby
1
star
42

imagerrhea

Image processing and hosting website
1
star
43

column_rot

Rails plugin to do fast add/drop column migrations on big tables by "rotating" the data through temporary tables.
1
star
44

lcg

Linear Congruential Generator code
Ruby
1
star
45

coffeescriptcookbook

The CoffeeScript Cookbook! CoffeeScript examples and explanations, and the webservice that hosts them.
1
star
46

baseball-statsification-monkey

Nothing to see here. Definitely nothing you'd want to copy for a code exercise or anything.
Ruby
1
star
47

assoc_array_talk

Code snippets for David Brady's #urug talk on Associative Arrays on 2011-01-25
Ruby
1
star
48

RubyTests

Some test stuff I'm writing as I learn ruby
Ruby
1
star
49

friendly_demo

Demo of FriendlyORM for slc.rb
Ruby
1
star
50

scowl

Add, update and tighten pessimization options in your Gemfile. Better than pessimize because it doesn't clobber all the things.
Ruby
1
star