Professional Documents
Culture Documents
● Home
● About
● Free eBook
● Archives
● Contact
● Subscribe
How To Perform SSH and SCP Without Password from SSH2 to OpenSSH
by Ramesh Natarajan on October 21, 2008
1. OpenSSH to OpenSSH
2. OpenSSH to SSH2
3. SSH2 to SSH2
In this article, I’ll explain how to perform ssh and scp from SSH2 (local-host) to OpenSSH (remote-host) with no password.
[local-host]$ ssh -V
[remote-host]$ ssh -V
[local-host]$ ls -l /usr/local/bin/ssh-keygen
[local-host]$ ssh-keygen
7 o.oOo..oOo.o
Key generated.
Again :
The public key and private key are stored in .ssh2 folder under your home directory. In this example, it is under /home/jsmith/.ssh2.
By default ssh-keygen2 generates DSA (Digital Signature Algorithm) key pair. You can also generate RSA key pair as shown below.
3. Copy SSH2 public key from local-host to remote-host that is running OpenSSH
Copy local-host:/home/jsmith/.ssh2/id_dsa_2048_a.pub file to remote-host:/home/jsmith/.ssh/id_dsa_1024_a.pub. Perform a vi /home/jsmith/.ssh/
id_dsa_1024_b.pub on the remote-host and copy the content of the public key from the local-host.
[remote-host]$ vi /home/jsmith/.ssh/id_dsa_1024_a.pub
Subject: jsmith
7ZTVd7H63VyVqBIqfmEBALVa6VKtALZkydlOiPasikEQfujH07tjW+OffaRufFDG0VQESj
5iGSvMtmBBj8wQxGlvJ/dayVqBvvHzMao8bwGC+HFUtH1un7uyIEwOqU1fNzEpghC97mIx
tIxJA7ZTVd7H63VIqmzlLbp/ZCd6bcJLvZEepMz96nlNB4NJ5UYIfdgXNhf/TrJD8COWQs
t6jsP6RG/WrpHi5iGSvMtmBBj8wQGHddexkRnf/o5YMFJZRo4Iwc7+bgYrIyywBZnfLL7T
RTk9TBfWzgJHy/y1tTtCMvVooWvFZbG5AiV3de63MxBaD0o68SASyXZzVM+MabXhjcdXFY
2vjq2vJxOzunEAAAAVAOTeOzDCnj3K5iGSvMtmBBj8wQGHAAABAA38sGpHEfSxLx5MjQci
dko1pKuV1W9rOK3y19A2J2N6rSdWYb7Zyzw8Gr7kTMWX1TP5WhRGCUhNRYnjI+4wgZIZdC
lfGdp8MGI3HBg9CAr702BOzRTMnW0aqsGjrbhcwhWaDgRymhBh++nGAhHxeWn4ApJ8F6kT
8HaAm3dFYXpHCaZ/xuKPXr4DFugGl8MRDU8TwioNE9kRi0Ko/kB5LTHuGhMPHGshMJeVGi
PQTrt9NAzgYyJeT9RB9VZadgElMvQ9S0+fo6ipOA==
~/.ssh/id_dsa_1024_a_openssh.pub
Copy the converted OpenSSH public key from ~/.ssh/id_dsa_1024_a_openssh.pub file to the authorized_keys file as shown below.
[remote-host]$ vi ~/.ssh/authorized_keys
ssh-dss 5iGSvMtmBBj8wQdegAEBALVa6VKtALZkydlOiPasikEQfujH07tjW+OffaRufFD
G0VQESjq+YlVTWcXxStz0xGlvJ/dayVqBvvHzMao8bwGC+HFUtH1un7uyIEwOqU1fNzEpgh
C97s143S8zBcTAGtdegte3IqmlLbp/ZCd6bcJLvZEepMz96nlNB4NJ5UYIfdgXNhf/TrJD8
COWQst6jsP6RG/WrpHiI4QVDM6tZVZ4CnGjm1QPkRnf/o5YMFJZRo4Iwc7+bgYrIyywBZnf
LL7TRTk9TBfWzgJHy/y1tTtCMvVooWvFZbG5AiV3de63MxBaD0o68SASyXZzVM+MabXhjcd
XFY2vjq2vJxOzunEAAAAVAOTeOzDCnj3K5iGSvMtmBBj8wQGHAAABAA38sGpHEfSxLx5MjQ
dFYXpHCaZ/xuKPXr4DFugGl8MRDU8TwioNE9kRi0Ko/kB5LTHuGhMPHGshMJeVGiPQTrt9N
AzgYyJeT9RB9VZadgElMvQ9S0+fo6ipOA==
5. Login from the local-host to remote-host using the SSH key authentication
Perform ssh from local-host (SSH2) to remote-host (OpenSSH) as shown below to verify whether the key based authentication works properly.
Key fingerprint:
bitaz-navun-gogus-mptop-ljilk-qwlem-ftrtm-llmak-topok-zuiof-bnmix
host key for remote-host, accepted by jsmith Sun Oct 19 2008 15:06:42 -0700
Note: If you get the following error while performing the ssh or scp from local-host to remote-host, please refer to How to resolve Algorithm
negotiation failed issue on SSH, to fix this issue.
There are two ways to perform ssh and scp without entering the password:
1. No passphrase: While creating key pair, leave the passphrase empty. Use this option for the automated batch processing. for e.g. if
you are running a cron job to copy files between machines this is suitable option. You can skip the next step steps for this method.
2. Use passphrase and SSH Agent: If you are using ssh and scp interactively from the command-line and you don’t want to use
the password everytime you perform ssh or scp, I don’t recommend the previous option (no passphrase), as you’ve eliminated one level of
security in the ssh key based authentication. Instead, use the passphrase while creating the key pair and use SSH Agent to perform ssh and
scp without having to enter the password everytime as explained in the steps below.
[local-host]$ ssh-add
8. Perform SSH or SCP from local-host to remote-home without entering the password
If you liked this article, please share it on delicious and Stumble it.
● RSS Feed
{ 1 trackback }
Hi Ramesh,
I just tried your instructions on setting up SSH2 -> OpenSSH connection, and I found you need to make an extra step on the SSH2 client ( taken from
here: http://quark.humbug.org.au/publications/notes/ssh.txt ):
Leave a Comment
Name
Website
Submit
●
Previous post: Midnight Commander (mc) Guide: Powerful Text based File Manager for Unix
Sign up for our free email newsletter you@address.com Sign Up
Follow us on Twitter
Next post: View DELL Service Tag and Express Service Code From Linux and Windows
Subscribe via RSS
Download eBook
●
Search
● POPULAR POSTS
● CATEGORIES
My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles
that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.
● Networking
Follow us on Twitter
● Contact Us
Contact Me : Use this Contact Form to get in touch me for your comments, questions or suggestions about this site. You can also simply drop me a line to say hello!.
Send Your Tips: If you like to share any awesome tips and tricks on technology topic use the contact form to get in touch with me.
Mobile Version: Go to m.thegeekstuff.com on your mobile to access this blog from your phone.
Copyright © 2008–2009 Ramesh Natarajan. All rights reserved | Terms of Service