LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-04-2008, 04:31 PM   #1
abovenbeyond
LQ Newbie
 
Registered: Oct 2006
Posts: 8

Rep: Reputation: 0
SCP from remote to local??


Hello all,
I think I am brain farting... I would like to scp something from a remote box, to my local box. The issue is the firewall won't allow it and I can't change that.

Can't I do something like this??

scp uname@ip:/path_to_file .

I am told if the request originates from behind the firewall (the local box) I can go out get it and come back, if that make since in my terminology. Other wise I would ssh to the box and scp the file back, but that don't work.

Thanks
 
Old 06-04-2008, 04:45 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,834
Blog Entries: 14

Rep: Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081
Yes.

scp requires a source and target. It doesn't care which is the local or the remote.

From the man page you see:
[[user@]host1:]file1 [...] [[user@]host2:]file2

This tells you that you can (but don't have to) specify user and host for either the local or the remote.

Due to this you could copy local files with scp any of the 3 ways shown below:
scp file1 file2
scp localhost:file1 localhost:file2
scp user1@localhost:file1 user1@localhost:file2

You can also copy local file to remote machine:
scp file1 user1@remotehost:file1

Or copy remote file to local machine:
scp user1@remotehost:file1 ./

By the way you only need the user@ specification if the name of the user on the two hosts is different. If you keep user UIDs in sync between systems it saves you typing in the long run (and also needing to chown files after transfers).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 12:23 PM
cronjob --> my script to scp to remote server bskrakes Linux - General 5 07-04-2007 04:25 PM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 07:20 AM
scp :copy file from one remote comp to another aniketh Linux - Networking 4 06-16-2004 02:31 AM
Remote Mounting? (Mount remote folder on local filesystem) mac_phil Linux - Networking 1 11-15-2003 03:48 PM


All times are GMT -5. The time now is 05:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration