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
536 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

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é.
Fine Tune your automatic Updates for Ubuntu / Debian
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

808 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