• Post Reply Bookmark Topic Watch Topic
  • New Topic

scp question  RSS feed

 
william chaple
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys might be a really dumb question...i kind of already know how to use scp
syntax I would normally use is
# scp ~/Desktop/file1 user1@buffalo.cs.edu:~/Desktop/Dir1

, however I am trying to see if it is possible to transfer a file to my home windows computer using putty.
At work, I have a linux machine called (deltaA) and a PDF file I want to transfer here to my Home windows computer called (BETA)
with BETA, I use putty to ssh into deltaA. Now, is it possible to SCP a file from deltaA to BETA? BETA is not a public IP, so there is no way i can do ex: scp ~/Desktop/file1 BETA@192.168.1.1

I know I can use winSCP, but I was just wondering if it is possible to use putty, connect to my works server, and transfer it to my private 192.168 address at home. thanks =)
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, this is a really gnarly problem.

One of the biggest obstacles is that Windows doesn't have any support at all for SCP because that's part of SSH and Windows doesn't have built-in SSH support.

PuTTy is a great program and its pscp program does service as an scp client, but unless I'm mistaken, PuTTy doesn't have the ability to function as an SSH/SCP server. Mostly because Windows doesn't run Windows shells natively and in fact, only really does multi-user properly if you're using something like Citrix.

I got around that problem by launching a Linux VM that ran under Windows. Linux, of course, comes with SSH support in just about any implementation can think of.

That's only half the problem, however. You now have an scp client available, but since you don't have a unique and public IP to connect to, there's no place to log in.

I got around that by using a reverse ssh tunnel. It wasn't possible to dial in to the Linux VM, so I had the Linux VM dial out to me. My production Linux servers have fixed IPs so there was a common public meeting point.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you just use pscp? http://the.earth.li/~sgtatham/putty/0.64/htmldoc/Chapter5.html#pscp
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pscp program is PuTTY's scp command-line utility and it suffers from the same limitation as the *n*x scp program - you cannot send to a non-public address from the public Internet. No program can.

That's why I had to set up a reverse tunnel.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:The pscp program is PuTTY's scp command-line utility and it suffers from the same limitation as the *n*x scp program - you cannot send to a non-public address from the public Internet.

But the command I gave as an example connects to the remote publicly accessible host (buffalo.cs.edu) as a valid user on that host (user1) and securely copies the file ~/Desktop/Dir1/theFile.pdf to the current directory on the local machine. I don't see why that's not possible. I do this kind of thing all the time when I work remotely from home.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In pscp documentation I cited previously, section 5.2.1 The Basics:
pscp documentation wrote:To receive (a) file(s) from a remote server:

pscp [options] [user@]host:source target
So to copy the file /etc/hosts from the server example.com as user fred to the file c:\temp\example-hosts.txt, you would type:

pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt

So it seems like it is possible, unless I am totally misunderstanding what the OP wants to do.
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You missed it, Junilu. William wants to PUSH from the work Linux machine (which may or may not have a public IP) to his home Windows machine (which does not have a public IP).

The pscp command you gave wants to PULL from the work machine (with an assumed public IP) to the home machine.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought the goal was to get the file on his local, so why would it matter if he was pushing or pulling? Is the means more important than the end?
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
william chaple wrote:I want to transfer here to my Home windows computer ...
but I was just wondering if it is possible to use putty, connect to my works server, and transfer it to my private 192.168 address at home. thanks =)

I do not interpret this as wanting to push and/or not wanting to pull. I ignore the 192.168 address part because I don't think the OP realizes that it's adding to his problem and preventing from seeing another means of accomplishing his goal which, again, I think is not specifically to PUSH the file from the remote host but rather to somehow get the remote file unto his local file system.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I get where you're coming from, Tim. You probably see OP as being at work and wanting to push a file to his home computer, which is remote. Of course, you are correct in saying that this is difficult to do unless OP is running an SSH server on his home computer and has it publicly accessible from the internet. The 192.168.x.x address indicates that this is not so and that he's just NATed behind his home router.

However, I think the problem is simpler than that. I think the OP is at home and just wants to get a file from his remote work computer unto his local FS.
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

At work, I have a linux machine called (deltaA) and a PDF file I want to transfer here to my Home windows computer called (BETA)
with BETA, I use putty to ssh into deltaA. Now, is it possible to SCP a file from deltaA to BETA?


So, work-to-home is the issue.

So yep, it's the hard direction that's at issue here, not the "easy" one.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:

At work, I have a linux machine called (deltaA) and a PDF file I want to transfer here to my Home windows computer called (BETA)
with BETA, I use putty to ssh into deltaA. Now, is it possible to SCP a file from deltaA to BETA?

So, work-to-home is the issue.

So yep, it's the hard direction that's at issue here, not the "easy" one.


It's an awkward sentence but I take the part that I bolded and underlined to mean that he's "here at home". Besides, it doesn't make much sense to me to want to push something to your home computer when you're already at work and the file is already accessible to you. If you need to work on it at home, then put it on a flash drive and take that home with you later. Problem solved. On the other hand, if I'm at home and I suddenly remember that there's a file in my work computer that I need, then definitely, the scenario that I have proposed makes perfect sense. Either way, why bother trying to do it the hard way when there's an easy way to do it?

Edit: Regarding "work-to-home" as being the issue, I don't think there's any argument there. The command is

pscp source target

Where source = work computer
and target = home computer

That is,

pscp user1@work.computer:file c:\localdir\file

I guess only OP can confirm what the situation really is but it seems like he's left the building. Ah well, I'll leave it at that and let OP chime in if and when he comes back.
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I think we lost OP a while back.

I had to read carefully to interpret what was being said as "I'm at home", actually. To me, it always sounded like "I'm at work, I already know how to pull stuff at home from work, but how to push stuff at work to home?

Partly this was because he'd already shown what he thought should be the command:


scp ~/Desktop/file1 BETA@192.168.1.1


That would be consistent with being at work and trying to push to BETA, which is the home machine. Also "~/Desktop" is a Linux file location which is what work is. The Windows machine is at home.

So that gives 2 issues. First, that Windows needs help, since there's no ssh daemon native to Windows to receive the file like there is on the work (Linux) machine.

Second, and more tellingly, 192.168.1.1 is not a public IP address, which means that reqardless of the OS involved it cannot be used as a target. I, too have a 192.168.1.1 IP address on my LAN, but I don't think he wants to ship files to me.

As I said, these are not insurmountable obstacles, but the solution is pretty arcane.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!