Copying files with scp - from a network to another network
I have a debian box, a.ces.school.edu, 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 - access.ces.school.edu, 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?
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.
You can copy the files to access.ces.school.edu and then transfer them to the other host.
Or you can ssh to access.ces.school.edu 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 access.ces.school.edu
$ scp user@home:~/.ssh/id_dsa.pub ~/
$ scp ~/id_dsa.pub firstname.lastname@example.org:~/
3. At a.ces.school.edu
$ cat ~/id_dsa.pub >> ~/.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 access.ces.school.edu '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. :)
FOrgot to add this point - The access.ces.school.edu has limited storage space. Its run by the school. I can try to forward the port on the router.
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.
|All times are GMT -5. The time now is 09:09 PM.|