Solved

How do I in shell terminal copy an entire file or directory file from one linux server to anouther linux server

Posted on 2010-09-14
10
541 Views
Last Modified: 2012-05-10
Ok I have centos os account on one server and I want to pull in my files from another server.

I want to do this in terminal mode. By ssh into the remote server getting my entire directory and copying it to my current location.
How would I do this
0
Comment
Question by:sobeservices2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 16

Assisted Solution

by:medvedd
medvedd earned 125 total points
ID: 33674866
scp -r user@host:/path/dir .

user - your username on remote server host
0
 
LVL 6

Assisted Solution

by:Jelcin
Jelcin earned 250 total points
ID: 33674872
you can use scp

scp root@192.168.178.1:/directory/file /local/directory/

would login on remote server 192.168.178.1 with user root and copy /directory/file from remote server to /local/directory/
0
 
LVL 6

Assisted Solution

by:Jelcin
Jelcin earned 250 total points
ID: 33675045
scp file  root@192.168.178.1:/directory/

would copy file on local computer to server 192.168.178.1 with user root to /directory/
0
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 

Author Comment

by:sobeservices2
ID: 33675394
I am trying to copy the home directory

would path be

/home/myname
usr/home/myname
I want everything from the home directory
0
 

Author Comment

by:sobeservices2
ID: 33675431
scp root@192.168.178.1:/directory/file /local/directory/

Worked how would I eliminate hidden files?
0
 
LVL 4

Accepted Solution

by:
rajendraone earned 125 total points
ID: 33675764
scp root@192.168.178.1:/directory/[^.]* /local/directory/

The expression [^.]* means any files that does not start with "." which are hidden.

0
 

Author Comment

by:sobeservices2
ID: 33675824
Thank you
0
 

Author Comment

by:sobeservices2
ID: 33676914
I tried this with another vm machine Solaris 10

and got this when I typed the line

ssh: connect to host columbia.com port22: Connection refused

What does this mean it worked ok on another vm
0
 
LVL 4

Expert Comment

by:rajendraone
ID: 33677068
That means columbia.com is not listening on port 22 or you cannot reach at port 22 of the server. It could be reachability issues or just the server is not listening to that port for anyone. Make sure sshd is running on the remote server.
You may verify if the server is listening to ssh by issueing following command:
$ netstat -na | grep 22
      *.22                 *.*                0      0 49152      0 LISTEN
If you see something like *.22 then it is listening on port 22.

First make sure you can ping to that server.
0
 
LVL 4

Expert Comment

by:rajendraone
ID: 33677084
Or sometimes, even when ssh is running you are not allowed ssh using root. Check /etc/ssh/sshd_config file at the remote server.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question