Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-05-2011, 06:25 AM   #1
LQ Newbie
Registered: May 2011
Posts: 3

Rep: Reputation: 0
Copying files with scp - from a network to another network

I have a debian box,, in my lab and my laptop also runs debian (on another DHCP lan home network outside school). I can access my lab's debian computer from outside school only by first ssh-ing to a server setup by the school -, and then, from the server ssh-ing to my lab computer. That works fine and I can view all my files on my lab computer from home.

But, I would like to copy some files from my lab computer to my home computer. With scp, I know how to do that if I could connect directly with my school computer. In the present scenario, I can't figure out how to copy files.

Does anyone know how this can be done?

Old 05-05-2011, 06:51 AM   #2
Senior Member
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
If both lab & laptop are on a private network, which I believe is the case, there are 2 ways to accomplish this.
1) From laptop, ssh in to schools server, which has a public ip.
Then scp from lab to server, followed by scp from laptop to server.
2) If your laptop is behind a decent router, setup portforwarding on router so port 22 is forwarded to laptop.
Then scp from lab to your routers public ip.
Old 05-05-2011, 07:00 AM   #3
Registered: Jun 2009
Location: Egypt
Distribution: Ubuntu 10.04
Posts: 117

Rep: Reputation: 16
Hi githin,

You can copy the files to and then transfer them to the other host.

Or you can ssh to and from there scp user@lab:~/src user@home:~/dst
but to do that you need to setup a pub_key private_key authentication between your host at home and your Debian box. To do that:
1. At home box:
$ ssh-keygen -t dsa
2. At gateway
$ scp user@home:~/.ssh/ ~/
$ scp ~/
3. At
$ cat ~/ >> ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh/authorized_keys
$ chmod 755 ~/.ssh

You might need to transfer the signature of both hosts on each other, I am not sure about this step cause I don't have same setup to try. but you got the idea.

If the above steps where successful you can from you lab just do ssh 'scp user@lab:~/src user@home:~/dst'

Again I don't have the setup to try that, so If It's successful with you please let me know.
Old 05-05-2011, 07:06 AM   #4
LQ Newbie
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Additional problem

FOrgot to add this point - The has limited storage space. Its run by the school. I can try to forward the port on the router.
Old 05-05-2011, 08:57 PM   #5
LQ Newbie
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for all the suggestions. It seems my school has a provision to allow direct ssh to my lab computer from outside the campus. If they do it for me, I can use the simple scp command to copy. If not, I will experiment with these methods.

BTW, I cleared up some space on the access machine and tried copying. That works fine, only that it is a two step process. Thanks once again.


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
Copying files over a network - Strange behaviour jsteel Linux - Networking 5 01-11-2010 01:32 PM
Copying Large Files on the Network bichonfrise74 Linux - Newbie 7 02-20-2009 12:48 PM
high IOWait on server when copying files from network InDubio Linux - Networking 2 03-12-2007 03:10 AM
Copying files through a network. Denwar Mandriva 1 04-13-2004 07:30 AM
copying files across the network jcwilliams Linux - Networking 2 01-12-2001 12:03 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:40 PM.

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