Recent News
An SSH one-liner to authorize via public-key
Here's a two-part tip on SSH productivity--you can use public-key authentication and SSH's built-in configuration options to save some time every day.
1) Authorize your public key. If you're like me, it's a bother to remember each little step -- here's the one-liner I use for convenience.
> ssh someuser@remotehost.com "echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys" |
This will append your key to the remote host's list of authorized keys.
Don't have a public key yet? You can generate one with:
> ssh-keygen |
You'll find a brand-new keypair in your ~/.ssh directory. Read up on public-key cryptography if it's new to you.
2) Now add the remote host to your (local) .ssh/config file:
1 2 3 |
Host rh Hostname remotehost.com User someuser |
The SSH config file can contain many entries; just add this to the list. "Host" is an alias/nickname/shortcut of your choosing.
So, you can now SSH to your remote host with:
> ssh rh |
This will save you a little typing. Public-key authentication is a "best practice" anyway -- it's good to develop the habit. For example, this is the only way to SSH into Amazon EC2 instances, and for administrators, it means you can share access to a SSH account (say, a deployer) without floating the password around.
Bonus tip: If you find Capistrano and Net::SSH behaving quirkily, make sure you have the latest versions of both. Recent updates to Net::SSH have included various updates and fixes relevant to public-key authentication.
cf. http://net-ssh.rubyforge.org/
cf. http://groups.google.com/group/capistrano/
written by shinji kuwayama on June 23rd, 2008 @ 02:46 PM
Comments
-
ceguyomvpaxcetgolubxagbjzlwlcr
Post a comment
cementhorses.com
Recent
- Engineering happiness (August 15th)
- The future with gestures (August 14th)
- Debugging Kentico sites in vs.net 2008/05 improve compilation time (August 14th)
- Resistance ...is a good thing? (August 13th)
- Managing dashboard widgets on various external displays (August 1st)
- Counting in CSS (July 28th)
- Take control of your server configuration with Capistrano (July 23rd)
- Time Parseable (July 23rd)
- An SSH one-liner to authorize via public-key (June 23rd)
- MicroApps (or little ditties) with Sinatra (June 17th)
- RoR: Schedulable (May 29th)
- Less work, more be-ing with quick shell aliasing (May 8th)
- Interceptor Methods (May 7th)
Comments
- Brandon Reis on Engineering happiness
- Lance Ribeiro on Engineering happiness
- Landon Moore on Engineering happiness
- Samuel Pires on Engineering happiness
- Brock on Engineering happiness
- Colton Sanches on Engineering happiness
- Caleb Mathews on Engineering happiness
- Collins on Engineering happiness
- Struye on Engineering happiness
- Jordan on Engineering happiness
- Aidan McDonough on Engineering happiness
- Tremonti on Engineering happiness
- Mathews on Engineering happiness
- Aiden Jones on Engineering happiness
- Rachman on Engineering happiness
Categories
- Stuff You Already Know (6)
- Open Source (2)
Cement Horses Pics
Archives
- August 2008 (5)
- July 2008 (3)
- June 2008 (2)
- May 2008 (3)
