LinuxQuestions.org
Review your favorite Linux distribution.
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 10-20-2009, 04:38 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Rep: Reputation: 32
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?
 
Old 10-20-2009, 05:26 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
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.
 
Old 10-20-2009, 07:39 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by acid_kewpie View Post
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 ~]#
 
Old 10-20-2009, 07:48 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Looks like it's not configured for password authentication, again, check the serverside logs. can you ssh into the server?
 
Old 10-21-2009, 01:30 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
I can't ssh to the server. I got

Code:
ssh_exchange_identification: Connection closed by remote host

Last edited by thomas2004ch; 10-21-2009 at 02:06 AM.
 
Old 10-21-2009, 01:47 AM   #6
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,274

Rep: Reputation: 148Reputation: 148
your remote server (where you want to copy the stuffs)
#ssh 172.23.53.10
 
Old 10-21-2009, 01:54 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
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.
 
Old 10-21-2009, 02:09 AM   #8
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by linuxlover.chaitanya View Post
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.
 
Old 10-21-2009, 02:19 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
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.
 
Old 10-21-2009, 02:20 AM   #10
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
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.
 
Old 10-21-2009, 03:59 AM   #11
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
I solved the problem now. I add the ip of the local server to the /etc/hosts.allow in remote server.
 
  


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
Strange scp issue while copying files gettons_slack Linux - Software 2 08-26-2006 06:33 AM
Strange scp issue while copying files gettons_slack Slackware 7 08-25-2006 02:53 PM
problem sending files with scp illiniguy3043 Linux - Newbie 1 06-27-2004 10:47 AM


All times are GMT -5. The time now is 12:00 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