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
533 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
 

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Intranet and Kerberos Authentication (not sharepoint!) 8 95
Running Jira on Raspberry PI 2? 3 137
Parse DNS log 3 34
Wireshark 7 54
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now