<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Sniptools &#187; SecureCRT</title> <atom:link href="http://sniptools.com/tag/securecrt/feed/" rel="self" type="application/rss+xml" /><link>http://sniptools.com</link> <description>Design &#38; Technology Observations</description> <lastBuildDate>Tue, 15 May 2012 09:23:41 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Save SSH password for use in &quot;Terminal&quot; (OSX or *Nix)</title><link>http://sniptools.com/mac-osx/save-ssh-password-in-terminal</link> <comments>http://sniptools.com/mac-osx/save-ssh-password-in-terminal#comments</comments> <pubDate>Sat, 19 Jul 2008 04:37:39 +0000</pubDate> <dc:creator>Shanx</dc:creator> <category><![CDATA[Mac OSX]]></category> <category><![CDATA[System Maintenance]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[OSX]]></category> <category><![CDATA[SecureCRT]]></category> <category><![CDATA[SSH]]></category> <category><![CDATA[Terminal]]></category> <category><![CDATA[Tips/Tricks]]></category> <category><![CDATA[Windows]]></category><guid
isPermaLink="false">http://sniptools.com/cms/?p=163</guid> <description><![CDATA[How to set up time-saving shortcuts for SSH in Mac OSX or Linux, a bit like SecureCRT on Windows. ]]></description> <content:encoded><![CDATA[<p>Anyone who runs hosted remote servers and has to log into remote terminals for regular use, it is vital to have shortcuts that allow for quick login. SSH2 is the recommended way.</p><p>On Windows, there is the fantastic SSH2 tool <a
href="http://www.vandyke.com/products/securecrt/">SecureCRT</a>. Or if you're cash crunched, a combination of Putty and Putty Connection Manager works for many.</p><p>On Mac OSX and Unix/Linux systems, one doesn't truly need an SSH client at all, because the "<a
href="http://www.osxterminal.com/">Terminal</a>" application is inbuilt. People talk of iTerm and such, but I have still to see a value add for such tools.</p><p>But one does miss the convenience of SecureCRT on OSX, because I have still to find a true SecureCRT alternative for the Mac platform. Something that allows me to make pre-determined connections so I can just click on them to connect (which tools like <a
href="http://www.grepsoft.net/jellyfissh.html">JellyfiSSH</a> do) and then logs me in directly without prompting for a password (which JellyfiSHH does not do).</p><p>So I have simply made aliases in my [code].profile[/code] file, which gets executed everytime you start your Terminal window (so it's a good place to put your shortcuts and any code you wish to execute when the terminal starts, such as paths).</p><ol><li>Start the Terminal.</li><li>Open the profile file for the current user (you).</li><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">pico .profile</pre></div></div><li>Enter a new line for our shortcut.</li><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">s</span>=<span style="color: #ff0000;">'ssh -2 -p 22 user@host.com'</span></pre></div></div></ol><p>Quick explanation for that command in step 3. The letter "s" is the shortcut I make for connecting to the sniptools.com server. Change it to what you wish. This will mean that when I start Terminal, all I need to do is type "s" and it connects me via SSH to the sniptools.com server. The "-p" switch is an important one because some of us with paranoid security settings might have a different port number than the default port 22 for secure SSH. The rest user/host stuff is self-explanatory. The "-2" is to force SSH2 connections instead of older vanilla SSH.</p><p>Now. Save the profile file and source it to try it out:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> .profile</pre></div></div><p>Sourcing is only for this one time, for your current Terminal window, which had already executed the profile file *before* we added this alias. When you start a new Terminal session, these aliases et al will be automatically set for you.</p><p>Done. Now your profile has the alias for "s". From now when you type "s" in your Terminal, it will connect, but it will ask you for a password. To get rid of the nagging password, we need to create public authentication key for the domain. This, in fact is what SecureCRT does behind the scenes on Windows too.</p><p>Here are the steps to accomplish this. Run these <strong>one-time</strong> commands in order from the Terminal window.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># generate pub and priv keys, leave the passphrase empty</span>
<span style="color: #666666; font-style: italic;"># (simply press ENTER when asked for it)</span>
<span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#copy the pub key to the remote computer</span>
<span style="color: #666666; font-style: italic;">#(change port number if different from the usual 22)</span>
<span style="color: #666666; font-style: italic;">#change &quot;user&quot; to your user name</span>
<span style="color: #666666; font-style: italic;">#change &quot;host&quot; to your domain name</span>
<span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #660033;">-P</span> <span style="color: #000000;">22</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub user<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#log on to the remote computer</span>
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">22</span> user<span style="color: #000000; font-weight: bold;">@</span>host
&nbsp;
<span style="color: #666666; font-style: italic;">#create the .ssh directory in the root login directory, if it doesn't already exist</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> .ssh
&nbsp;
<span style="color: #666666; font-style: italic;">#append key to file</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> id_rsa.pub <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys
&nbsp;
<span style="color: #666666; font-style: italic;">#delete the public key file, no longer needed</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> id_rsa.pub
&nbsp;
<span style="color: #666666; font-style: italic;">#log off the remote server</span>
<span style="color: #7a0874; font-weight: bold;">exit</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#logon to the remote server, without password prompt</span>
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-2</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">22</span> user<span style="color: #000000; font-weight: bold;">@</span>host</pre></td></tr></table></div><p>That's it. This is a huge timesaver. Now all I need to do to login to the sniptools.com server is type one letter, "s" in the Terminal, and I'm on! Follow these instructions for each host you connect to on a regular basis and you'll love the convenience henceforth.</p> ]]></content:encoded> <wfw:commentRss>http://sniptools.com/mac-osx/save-ssh-password-in-terminal/feed/</wfw:commentRss> <slash:comments>19</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 4/7 queries in 0.002 seconds using disk: basic
Object Caching 529/532 objects using disk: basic

Served from: sniptools.com @ 2012-05-21 19:17:05 -->
