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
535 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

770 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