Note that there are some explanatory texts on larger screens.

plurals
  1. POCentOS scp without password not working
    text
    copied!<p>I have been trying to connect from one <strong>EC2 instance</strong> to another using ssh public keys and have been having a very tough time.</p> <p>Here is the scenario: I need to have box 2 scp a file from box 1 in a script. This script will need to be able to scp without a password so I need to setup public keys.</p> <p>On box 2 I ran <code>ssh-keygen –t rsa</code> and generated <code>id_rsa</code> and <code>id_rsa.pub</code> I copied <code>id_rsa.pub</code> to box 1 I moved <code>id_rsa.pub</code> to .ssh and ran <code>cat id_rsa.pug &gt;&gt; authorized_keys</code> I changed permissions of all .ssh directory to <em>700</em> on both boxes and the files themselves to <em>600</em>. I have changed the sshd_config settings on box 1 to:</p> <pre><code>RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys </code></pre> <p>And then restarted ssh </p> <pre><code>/sbin/service sshd restart </code></pre> <p>When I try to scp or ssh into box1 from box1 I get the error:</p> <pre><code>Address 67.22.33.1 maps to ec2-67-22-33-1.compute-1.amazonaws.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! tomcat@tomcat1.****.com's password: </code></pre> <p>Any ideas?</p> <hr> <p>I made that change and tried scp to tomcat1 and it failed. Here is the output:</p> <pre><code>debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to tomcat1.****.com [67.22.33.15] port 22. debug1: Connection established. debug1: identity file /home/tomcat/.ssh/identity type -1 debug1: identity file /home/tomcat/.ssh/id_rsa type 1 debug1: identity file /home/tomcat/.ssh/id_dsa type -1 debug1: loaded 3 keys debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3 debug1: match: OpenSSH_4.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server-&gt;client aes128-cbc hmac-md5 none debug1: kex: client-&gt;server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY The authenticity of host 'tomcat1.****.com (67.22.33.15)' can't be established. RSA key fingerprint is 5a:3e:fe:be:b8:0e:05:63:bf:ab:c8:4f:e5:91:db:a0. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'tomcat1.****.com,67.22.33.15' (RSA) to the list of known hosts. debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /home/tomcat/.ssh/identity debug1: Offering public key: /home/tomcat/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Trying private key: /home/tomcat/.ssh/id_dsa debug1: Next authentication method: password </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload