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
539 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Suggested Courses

739 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