generate iterm2 profiles from ~/.ssh/config

1,133 views
Skip to first unread message

Richard Sugg

unread,
Aug 11, 2015, 9:08:09 AM8/11/15
to iterm2-discuss
I manage all my connections in ~/.ssh/config so that in iTerm, all my remote connections have the simple command "ssh <server>". ~/.ssh/config takes care of weird ports or different username, etc. I wrote a script that will generate a json file of dynamic profiles by reading in your ~/.ssh/config. 

Save, make executable, run, and you'll have a file "profiles.json" in your iterm2 dynamic profiles directory. 


If you want to use tags, you can add a comment to the Host line like this:

Host myserver # Tags=tag1, tag2
    HostName myserver.domain.com
    User myusername
    Port 8022

This will create an iterm dynamic profile like this:

[
    ...
    {
         "Guid" : "myserver",
         "Name" : "myserver",
         "Shortcut" : "",
         "Custom Command" : "Yes",
         "Tags" : [
            "tag1",
            "tag2"
         ],
         "Command" : "ssh myserver"
    },
    ....
]

George Nachman

unread,
Aug 11, 2015, 6:56:38 PM8/11/15
to iterm2-...@googlegroups.com
This is really cool! Would you be OK releasing it under GPL so I can include it with iTerm2?

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Sugg

unread,
Aug 11, 2015, 8:30:11 PM8/11/15
to iterm2-...@googlegroups.com
absolutely! I added a small header to say as much.

Richard Sugg

unread,
Aug 11, 2015, 8:39:15 PM8/11/15
to iterm2-discuss, gnac...@llamas.org
Absolutely! I've modified the header to say as much.

Jeremy Wilson

unread,
Aug 18, 2015, 12:30:53 PM8/18/15
to iterm2-discuss, gnac...@llamas.org
This generates a file, but iTerm2 doesn't seem to read it in.  How do I get it to recognize it?

Richard Sugg

unread,
Aug 18, 2015, 5:48:08 PM8/18/15
to iterm2-discuss, gnac...@llamas.org
Not sure...As far as I know, as long as the file is in the right location and is the right format, iterm recognizes it. Are you using the 2.9 version of iterm?

Jeremy Wilson

unread,
Aug 18, 2015, 5:54:29 PM8/18/15
to iterm2-...@googlegroups.com, gnac...@llamas.org

> On Aug 18, 2015, at 5:48 PM, Richard Sugg <richa...@gmail.com> wrote:
>
> Not sure...As far as I know, as long as the file is in the right location and is the right format, iterm recognizes it. Are you using the 2.9 version of iterm?

I’m using 1.10 from the website. Where am I supposed to get this 2.9 version?

Richard Sugg

unread,
Aug 18, 2015, 6:07:11 PM8/18/15
to iterm2-discuss, gnac...@llamas.org
that would be the problem. See https://iterm2.com/version3.html

Dave Wikoff

unread,
Mar 2, 2016, 7:49:31 PM3/2/16
to iterm2-discuss, gnac...@llamas.org
Very nice, was looking for something like this - I'll probably make some tweaks so that it is either Opt-in or that it's possible to skip a record and not import it. (I have a lot of servers in my ssh config....)
Reply all
Reply to author
Forward
0 new messages