LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2010, 01:19 AM   #1
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 218

Rep: Reputation: 27
scp error while copying files between two remote computers


hi,

iam trying to scp files between two remote computers, i get the following error:
Host key verification failed.
lost connection

What i am trying to do is :
scp u1@ip1:/source_path u2@op2:/destination_path

I am able to ssh into both machines fine, so i know that works. I tried google for this but couldn't make much of the results.

Thanks
 
Old 07-28-2010, 02:17 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 532

Rep: Reputation: 78
Have you try to remove the key from your ~/.ssh folder?

to do so, just empty this folder (or rename it if you have some important keys in there) and try again.

Angel
 
Old 07-28-2010, 02:24 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by austinium View Post
hi,

iam trying to scp files between two remote computers, i get the following error:
Host key verification failed.
lost connection

What i am trying to do is :
scp u1@ip1:/source_path u2@op2:/destination_path

I am able to ssh into both machines fine, so i know that works. I tried google for this but couldn't make much of the results.

Thanks

First step should be to bump up verbose output ...

Code:
scp -vv ...

Cheers,
Tink
 
Old 07-29-2010, 02:27 AM   #4
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 218

Original Poster
Rep: Reputation: 27
thanks for the replies...
i deleted ~/.ssh/known_hosts --- didn't help
i am able to copy onto remote machine from local machine, however its when both the source and destination are remote that it fails to work.
the output of scp -vv is as follows

Code:
 scp -vv root@10.0.13.91:~/temp root@10.0.14.170:~/
Executing: /usr/bin/ssh '-v' '-x' '-oClearAllForwardings yes' '-n' '-l' 'root' '10.0.13.91' 'scp -v' '~/temp' 'root@10.0.14.170:~/'
OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.0.13.91 [10.0.13.91] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-2
debug1: match: OpenSSH_4.7p1 Debian-2 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<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
debug1: Host '10.0.13.91' is known and matches the RSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:2
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/user/.ssh/identity
debug1: Trying private key: /home/user/.ssh/id_rsa
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Next authentication method: password
root@10.0.13.91's password: 
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_IN
debug1: Sending command: scp -v ~/temp root@10.0.14.170:~/
Executing: program /usr/bin/ssh host 10.0.14.170, user root, command scp -v -t ~/
OpenSSH_4.7p1 Debian-2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.0.14.170 [10.0.14.170] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.7p1 Debian-2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<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
debug1: Host '10.0.14.170' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
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: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).
lost connection
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 1376, received 5624 bytes, in 0.3 seconds
Bytes per second: sent 4960.1, received 20272.9
debug1: Exit status 1
 
Old 07-29-2010, 04:48 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

I hope I'm reading this the wrong way, but just to make sure:

Are you executing the scp command on computer A and try to scp file(s) from computer B to computer C? If so: That doesn't work.

Scp copies files from the host you are on to a remote host (or vice versa).

Hope this helps.
 
Old 07-29-2010, 09:55 AM   #6
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 218

Original Poster
Rep: Reputation: 27
druuna: that was what i was trying
 
Old 02-16-2014, 01:06 AM   #7
bharathkumar1207
LQ Newbie
 
Registered: Feb 2014
Posts: 1

Rep: Reputation: Disabled
SCP Permission denied

hi,

iam trying to scp files between two remote computers, i get the following error:

permission denied please try again

What i am trying to do is :
scp u1@ip1:/source_path u2@op2:/destination_path

I am able to communicate into both machines fine, so i know that works. I tried google for this but couldn't make much of the results.

Thanks
Bharath

waiting for your answer .....
 
Old 02-16-2014, 10:27 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
1. Can you establish a ssh to both systems?
2. can you establish a ssh session from u1@ip1 to u2@op2?
3. do you have access to the /source_path on u1, and write access to /destination_path on u2?

The way ssh works here is to first make an ssh connection to u1, from u1 it makes a ssh session to u2 to copy the files - that way there is no interaction with the workstation. (granted, you get the same result if it first connects to u2 to make a connection to u1 to copy from, I don't remember now which way it actually goes).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem by copying files with SCP thomas2004ch Linux - Newbie 10 10-21-2009 04:59 AM
scp - Two computers, can only transfer files one way jqweezy Linux - Networking 2 02-13-2009 03:12 PM
Strange scp issue while copying files gettons_slack Linux - Software 2 08-26-2006 07:33 AM
Strange scp issue while copying files gettons_slack Slackware 7 08-25-2006 03:53 PM


All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration