LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem by copying files with SCP (https://www.linuxquestions.org/questions/linux-newbie-8/problem-by-copying-files-with-scp-763148/)

thomas2004ch 10-20-2009 04:38 AM

Problem by copying files with SCP
 
I will copy all the files include the directories from one server to another.

I login to server as user inet:
Code:

[inet@s003ap18 ~]
The location is /opt/jboss/INET

Now I begin to copy all the directories and all the files under the directories with:
Code:

scp -r inet@s003ap10:/opt/jboss/INET/ ./
But I got error as follow:
Code:

ssh_exchange_identification: Connection closed by remote host
Someone has idea?

acid_kewpie 10-20-2009 05:26 AM

add a -v to the scp command and also check the /var/log/secure and /var/log/messages files on the server side. Sounds like you have RSA / DSA keys installed which aren't working maybe.

thomas2004ch 10-20-2009 07:39 AM

Quote:

Originally Posted by acid_kewpie (Post 3725863)
add a -v to the scp command and also check the /var/log/secure and /var/log/messages files on the server side. Sounds like you have RSA / DSA keys installed which aren't working maybe.

I got followings as I add a -v to scp:
Code:

[root@s003ap18 ~]# scp -v inet@s003ap10:/opt/jboss/INET/.bash_history ./
Executing: program /usr/bin/ssh host s003ap10, user inet, command scp -v -f /opt/jboss/INET/.bash_history
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to s003ap10 [172.23.53.10] 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
ssh_exchange_identification: Connection closed by remote host
[root@s003ap18 ~]#


acid_kewpie 10-20-2009 07:48 AM

Looks like it's not configured for password authentication, again, check the serverside logs. can you ssh into the server?

thomas2004ch 10-21-2009 01:30 AM

I can't ssh to the server. I got

Code:

ssh_exchange_identification: Connection closed by remote host

kirukan 10-21-2009 01:47 AM

your remote server (where you want to copy the stuffs)
#ssh 172.23.53.10

linuxlover.chaitanya 10-21-2009 01:54 AM

Thomas, you just edited your previous post where you mentioned the problem was solved. Why do you want to edit your post and ask the question again?
scp works on ssh so if you can not ssh into your machine you would not be able to scp the files to remote machine.
And if you have configured ssh for passwordless authentication, then you need public keys to be stored in .ssh folder in the home folder of the user.

thomas2004ch 10-21-2009 02:09 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 3726891)
Thomas, you just edited your previous post where you mentioned the problem was solved. Why do you want to edit your post and ask the question again?
scp works on ssh so if you can not ssh into your machine you would not be able to scp the files to remote machine.
And if you have configured ssh for passwordless authentication, then you need public keys to be stored in .ssh folder in the home folder of the user.

Sorry, I made mistake. I can ssh to another server, not the one I mentioned.

acid_kewpie 10-21-2009 02:19 AM

Right, so it's rsa keys or it's not configured to use password authentication. have you checked the serverside logs? if your keys are misconfigured, try adding -O RSAAuthentication=no to prevent using it.

linuxlover.chaitanya 10-21-2009 02:20 AM

Ok. So you need to first make sure you can ssh to the machine you want to copy the files to (destination machine) using scp.
Once you are successful in establishing the ssh connection, you can try scp.

Oops...Chris came in here first.

thomas2004ch 10-21-2009 03:59 AM

I solved the problem now. I add the ip of the local server to the /etc/hosts.allow in remote server.


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