Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbrady/ssh-config

A Tool to help manage your .ssh/config file.
https://github.com/dbrady/ssh-config

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

= 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

Adds or updates the value for a given host.

=== unset

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

=== rm

Removes an entire host section.

=== copy [ [...]]

Copies the entire section named to a new section called
. 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 [ ...]

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

=== search

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 [ ...]

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

=== unalias [] [ ...]

With 2 or more arguments, looks up host by (must be the first
name on the Host line), and removes any 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.