LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SCP Copy from Linux to Windows? (https://www.linuxquestions.org/questions/linux-newbie-8/scp-copy-from-linux-to-windows-250284/)

mhague 11-02-2004 01:07 PM

SCP Copy from Linux to Windows?
 
Hi,
I am very new to Linux, but have figured out how to use SCP to copy a file from Linux box to Linux box. I am using a private key so I won't have to enter a user and password. This works great!

This is a process that needs to happen each day (I've scripted it), and my ultimate goal is to get the file from the Linux box to my Windows PC.

Can SCP be used to copy the file from Linux to Windows directly? If so, can I still use the same key to authenticate? Where does the key file reside on my Windows PC?

I tried using PSCP (from Windows) to 'get' the file from Linux. I'm getting 'connection timed out'. If PSCP is the only option, again, can I use the key to authenticate?

Thanks for any help! I've spent some time on this and am kind of frustrated at this point.

Marcie

Blinker_Fluid 11-02-2004 02:04 PM

Not sure about a push from Linux to Windows... However it would be possible to pull it.

Here's my command to pull in the file I want:
c:\downloads\pscp -pw password blink@192.168.0.5:/home/blink/junk c:\foo\

I created a batch file to run called it c:\stupid.bat and put the command to run in it and verified it would run when i typed 'c:\stupid.bat'

I then go on my windows box and create a scheduled task.
Start --> Programs --> Accessories --> System Tools --> Scheduled tasks
It takes you through a Wizard to set it up. Put c:\stupid.bat in for the command to run.

I've never messed with the private key on windows but you could probably do that instead of putting in the -pw command for your password.

Hope that gets you a little farther along...

jcspray 11-02-2004 02:15 PM

I've had some success with winscp for scping stuff from a linux box. Note that whichever side you're initiating the connection from is the client; the other machine is the server. That means that whichever machine is connected to will need to be running the openssh daemon. My point, anyway, is that either your script will have to be on the windows box or your windows box will have to be running a ssh daemon.

huibert.alblas 11-02-2004 02:31 PM

cygwin
 
AFAIK it is posible to instal sshd on cygwin (a unix enviroment for windows)
here you could use your private key, and all other linux goodies it even runs kde and gimp :-)

jschiwal 11-02-2004 03:50 PM

This isi a case where experimentation will supply the best answer. You may need an active session started from the windows box. Start the ssh program from windows ( putty or ssh32 ) and leave it running. Then try the 'scp command from the Linux box. If they were linux boxes, you could have a script on Machine C that would scp a file from Machine A to Machine B. If this experiment works then this may be possible if Machine A or B were windows.

Blinker_Fluid 11-03-2004 11:13 AM

Could even do a NFS mount to a windows share and just copy that way too...

mhague 11-03-2004 11:22 AM

Thanks to all for you ideas! One of my problems is that I didn't have SSH running on the Windows box. I'm looking at a couple of the free SSH programs and I'm going to experiment. I'm also looking at trying to get the private key working to I can pull the file from Linux with no password. I had created a public key and that is probably why things didn't work.

I didn not realize there were so many options!!

Marcie

shy 11-03-2004 12:03 PM

Quote:

Originally posted by mhague
I'm also looking at trying to get the private key working to I can pull the file from Linux with no password.
I use putty to login from my work windows PC to the home one. Puttygen is a part of putty distribution, and can be used to create public/private keys that putty understands.

mhague 11-03-2004 01:56 PM

PSCP from Windows to Linux Works!
 
Whoo hoo! It works.

For others who may have the same problem, here are the steps I followed:

1) On the Windows box (client) Use puttygen.exe to create a public/private key.
2) Using a text editor, copy the public key that puttygen creates to a file called 'authorized_keys' (or authorized_keys2 depending on whether you are using SSH1 or SSH2).
3) Place the 'authorized_keys' file on the Linux box in the directory you need to access in the .ssh sub-directory. chmod 644 on the 'authorized_keys' file.
4) On the Windows box, using the pscp command, enter the following:

pscp -i full_path_to_private_key_file/private_key_file_name linuxuser@999.999.999.999:/full_path_to_file_to_copy destination_location_of_file


All times are GMT -5. The time now is 06:59 PM.