scp without prompting for password | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

scp without prompting for password

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-24-2011
satish@123 satish@123 is offline
Registered User
 
Join Date: Mar 2007
Last Activity: 1 April 2014, 1:25 AM EDT
Posts: 64
Thanks: 2
Thanked 0 Times in 0 Posts
scp without prompting for password

I am trying to copy a file from remote machine using scp. I followed the steps to configure public/private key usage. But still prompting for password when I do ssh.

I did the following steps to configure scp without asking password

Step 1 : local host
Code:
> ssh-keygen -t rsa

and when prompted for pass phrase I hit enter. Then id_rsa , id_rsa.pub files created in <usershome>/.ssh directory.

Step 2 : local host
Code:
> scp id_rsa.pub <remoteIP>:/tmp/mykey

, prompted for password as usual and provided password to copy.

Step 3 : Remote host
Code:
> cd ~/.ssh
cat /tmp/mykey >> authorized_keys2

step 4 : Remote host
Code:
> ln -s authorized_keys2 authorized_keys

step 5 : local host
Code:
> ssh -v <remote host>
Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to <remote host> [<remote host>] port 22.
debug1: Connection established.
debug1: identity file /home/users/sbob/.ssh/id_rsa.pub type 1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1
debug1: no match: Sun_SSH_1.1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: Peer sent proposed langtags, ctos: i-default
debug1: Peer sent proposed langtags, stoc: i-default
debug1: We proposed langtags, ctos: i-default
debug1: We proposed langtags, stoc: i-default
debug1: Negotiated lang: i-default
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: Remote: Negotiated main locale: C
debug1: Remote: Negotiated messages locale: C
debug1: dh_gen_key: priv key bits set: 135/256
debug1: bits set: 1587/3191
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '<remote host>' is known and matches the RSA host key.
debug1: Found key in /home/users/sbob/.ssh/known_hosts:1
debug1: bits set: 1548/3191
debug1: ssh_rsa_verify: signature correct
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: Next authentication method: gssapi-with-mic
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
debug1: Next authentication method: publickey
debug1: Trying public key: /home/users/sbob/.ssh/id_rsa.pub
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password:

still asking for password. what would be the reason?

Last edited by pludi; 05-24-2011 at 07:22 AM..
Sponsored Links
    #2  
Old 05-24-2011
Skrynesaver's Avatar
Skrynesaver Skrynesaver is offline Forum Advisor  
Grumpy old geek
 
Join Date: Mar 2011
Last Activity: 28 July 2014, 4:11 AM EDT
Location: Éire
Posts: 800
Thanks: 19
Thanked 181 Times in 177 Posts
Try a different public key method such as DSA, almost the same procedure, rinse and repeat until you have created a key for an agreed protocol


Code:

$ ssh-keygen -t dsa 
(accept the default for all queries)  
$ cat ~/.ssh/id_dsa.pub | ssh $REMOTE_HOST  "mkdir .ssh ; cat >>.ssh/authorized_keys" 
(enter your password)  
$ ssh $REMOTE_HOST echo 
$ssh $REMOTE_HOST
(should bring you over without keyboard interaction)


Last edited by Skrynesaver; 05-24-2011 at 07:31 AM.. Reason: removed accidental space in code.
Sponsored Links
    #3  
Old 05-24-2011
satish@123 satish@123 is offline
Registered User
 
Join Date: Mar 2007
Last Activity: 1 April 2014, 1:25 AM EDT
Posts: 64
Thanks: 2
Thanked 0 Times in 0 Posts
I got the same again. Again it is prompted for password. I followed the exact steps by removing space at . ssh to .ssh.
    #4  
Old 05-24-2011
Skrynesaver's Avatar
Skrynesaver Skrynesaver is offline Forum Advisor  
Grumpy old geek
 
Join Date: Mar 2011
Last Activity: 28 July 2014, 4:11 AM EDT
Location: Éire
Posts: 800
Thanks: 19
Thanked 181 Times in 177 Posts
And if you try with rsa1 publickey?
Code:
ssh-keygen -t rsa1

Assuming that you're talking to an old Sparc box that only does ssh version 1
Sponsored Links
    #5  
Old 05-24-2011
pludi's Avatar
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
Can you check the permissions on ~.ssh, ~.ssh/authorized_keys2? SSH is quite picky about them. If in doubt, allow access only to the user, and remove all permissions for group and other.

By the way, a simpler way to install the public key is ssh-copy-id, which is part of OpenSSH.
Sponsored Links
    #6  
Old 05-24-2011
satish@123 satish@123 is offline
Registered User
 
Join Date: Mar 2007
Last Activity: 1 April 2014, 1:25 AM EDT
Posts: 64
Thanks: 2
Thanked 0 Times in 0 Posts
It didn't help. Any issue if the architecture differs, I am using solaris 10 sparc and solaris 10 X86 machines.
Sponsored Links
    #7  
Old 05-24-2011
purdym purdym is offline
Registered User
 
Join Date: Nov 2010
Last Activity: 1 November 2011, 11:16 AM EDT
Posts: 173
Thanks: 0
Thanked 19 Times in 19 Posts
Try running ssh agent to cache the pass phrase.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ssh via java prompting for password nrworld Programming 3 08-25-2010 11:57 AM
superuser without prompting for pswd. Ashok_107 Solaris 3 01-09-2009 09:09 AM
sftp prompting for password dsravan UNIX for Dummies Questions & Answers 1 05-03-2007 07:47 PM
SSH - Prompting for password shihabvk UNIX for Advanced & Expert Users 8 08-21-2006 06:07 PM
not script prompting but,............. Astudent UNIX for Dummies Questions & Answers 3 12-03-2000 10:05 AM



All times are GMT -4. The time now is 08:21 AM.