{"id":526,"date":"2009-01-19T21:10:28","date_gmt":"2009-01-19T20:10:28","guid":{"rendered":"http:\/\/unorganized.net\/wp\/?p=526"},"modified":"2011-12-16T09:56:28","modified_gmt":"2011-12-16T08:56:28","slug":"open-ssh-connections-with-butler","status":"publish","type":"post","link":"https:\/\/unorganized.net\/blog\/2009\/01\/19\/open-ssh-connections-with-butler\/","title":{"rendered":"Open SSH Connections with Butler"},"content":{"rendered":"<p>How to use <a href=\"http:\/\/www.manytricks.com\/butler\/\">Butler<\/a>, <a href=\"http:\/\/www.gnu.org\/software\/screen\/screen.html\">screen<\/a>, SSH and some shell Skripts to open SSH Connections to some servers.<br \/>\nFirst, create a directory which will contain the script(s) to connect to the servers &#8211; I use <code>~\/bin\/Terminals<\/code>. In that, place a file containing the following code:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1; highlight: []; html-script: false\">\r\n#!\/bin\/bash\r\nexec ssh -t `basename $BASH_SOURCE` screen -DR ; exit\r\n<\/pre>\n<p>The filename should be the servername to connect to, you can use <code>~\/.ssh\/config<\/code> to define short aliases for your servers:<\/p>\n<pre class=\"brush: text; gutter: true; first-line: 1; highlight: []; html-script: false\">Host myshortalias HostName long.hostname.tld User ausername<\/pre>\n<p>This allows you to do <code>ssh myshortalias<\/code> to connect to the server in question. So, to connect to this server, name the file in <code>~\/bin\/Terminals<\/code> <code>myshortalias<\/code>.<br \/>\nMake the <code>myshortalias<\/code> file executable: <code>chmod 755 myshortalias<\/code><br \/>\nTry to open a connection via the <code>myshortalias<\/code> file: <code>.\/myshortalias<\/code> &#8212; if this fails, you problably don&#8217;t have <code>screen<\/code> installed on the server &#8211; I really recommend to install it.<br \/>\nOK, if that works, disconnect from the server, and open the Butler Configuration.<br \/>\nExpand the &#8220;Hidden&#8221; elements, if they are not visible. Select &#8220;Add File&#8221; from the plus button. Navigate to the <code>~\/bin\/<\/code> folder and select the &#8220;Terminals&#8221; folder to add it to the Butler Configuration.<br \/>\n<a class=\"serendipity_image_link\" onclick=\"F1 = window.open('\/blog\/uploads\/butler.png','Zoom','height=705,width=1016,top=255,left=459.5,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes'); return false;\" href=\"\/blog\/uploads\/butler.png\"><!-- s9ymdb:2 --><img loading=\"lazy\" decoding=\"async\" class=\"serendipity_image_left\" style=\"float: left; border: 0px; padding-left: 5px; padding-right: 5px;\" src=\"\/blog\/uploads\/butler.serendipityThumb.png\" alt=\"\" width=\"110\" height=\"76\" \/><\/a>Select the &#8220;Terminals&#8221; container, open the &#8220;Triggers&#8221; tab, assign a Hot Key, change mode to &#8220;Opens a menu near the mouse&#8221;.<br \/>\n<a class=\"serendipity_image_link\" onclick=\"F1 = window.open('\/blog\/uploads\/butler2.png','Zoom','height=705,width=1016,top=255,left=459.5,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes'); return false;\" href=\"\/blog\/uploads\/butler2.png\"><!-- s9ymdb:3 --><img loading=\"lazy\" decoding=\"async\" class=\"serendipity_image_right\" style=\"float: right; border: 0px; padding-left: 5px; padding-right: 5px;\" src=\"\/blog\/uploads\/butler2.serendipityThumb.png\" alt=\"\" width=\"110\" height=\"76\" \/><\/a> Select the &#8220;Terminals&#8221; folder, select the &#8220;Menu Filter&#8221; tab, change &#8216;Menus show\u00e2\u0080\u00a6&#8217; to &#8220;this folder&#8217;s content with X levels of recursion&#8221;, activate &#8220;Translate subfolders into menus&#8221;.<br \/>\nSelect the &#8220;Options&#8221; tab and change the &#8216;Open with\u00e2\u0080\u00a6&#8217; setting to &#8220;Terminal&#8221; (or iTerm or &#8230;).<br \/>\nPressing your hot key should now show a menu with the <code>myshortalias<\/code> script. You can add subfolders to the <code>~\/bin\/Terminals<\/code> folder to group your servers. To add a server, just copy (or even better: hard-link) the <code>myshortalias<\/code> file to a new name which corresponds to a <code>Host<\/code> config in <code>~\/.ssh\/config<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to use Butler, screen, SSH and some shell Skripts to open SSH Connections to some servers. First, create a directory which will contain the script(s) to connect to the servers &#8211; I use ~\/bin\/Terminals. In that, place a file containing the following code: #!\/bin\/bash exec ssh -t `basename $BASH_SOURCE` screen -DR ; exit The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-mac"],"_links":{"self":[{"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":7,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/posts\/526\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unorganized.net\/blog\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}