Tech Musings

Friday, February 10, 2017

Saving SSH Connection Settings

For the life of me I couldn't remember how to save a customized SSH session today on my local computer. I've done it before, but it's been a while and I wasn't able to figure it out after a quick Google search. So... I guess it makes sense to post these directions so I can refer to them again when I undoutedly suffer brain plaque on this topic in the future.

It's pretty easy to customize the OS X Terminal including changing its background color, text size, font type, etc. However, to execute a SSH command directly upon Terminal's launch one must edit the appropriate *.term file in ~/Library/Application Support/Terminal/ with either the PropertyListEditor application (included as part of Developer Tools) or with a sufficient text editor like BBEdit or even pico.

*.term library files are formatted as XML plists. First, save the session window via Terminal > File > Save As..., then look for the "shell key" at line #194 in the corresponding *.term file and enter the appropriate path to SSH followed by the remote server's authentication URL. For example, to connect via secure shell from my client to my server which hosts site.domain.net on port 2444 , I would enter the following command into the string variable of my Shell key:

<key>Shell</key>
<string>/usr/bin/ssh root@site.domain.net -p2444</string>

It's possible to include the password (e.g. root:password@root@site.domain.net -p2444) in the string, but keep in mind the password won't be encrypted and is "a sitting duck" as clear text on the local machine (i.e. hacker's delight).

0 Comments:

Post a Comment

<< Home