Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I did this to copy files between Windows and Linux.

C:\Documents and Settings\668340\My Documents\putty>pscp  "C:\Documents and Settings\563456\abc.txt" "auto_root@10.39.5.41:/home/auto/"

But it prompts for a password and how do i automate this task using private/public key pairs between windows and linux

Even winscp works but only problem is that i have to use hard coded password in the code, which I don't want. Instead I want to use private/public key addition concept but not aware how to do it when it is windows.

EDIT:i mean i can go with passwordless authentication but still it involes ,the manual process of generating public,private keys(.ppk) using puttygen.exe in windows and then copying the public key to .ssh\authorized in linux.is there any way to automate this.

EDIT:if there is any of copying files by running some shell script of command in unix to copy file to windows that could also be usefull as i can create public/private keys in unix automatiaclly.

share|improve this question
1  
You can use the same public/private key pair on all your windows machines. Copying files from unix to windows is difficult (only way is using SMB/CIFS), but you e.g. run a web server on your unix machine and then let the windows client download files using e.g. wget compiled for Windows –  jofel Jan 25 '13 at 11:21

3 Answers 3

up vote 2 down vote accepted

As you want to authenticate without prior key exchange, I see no other option than using password authentication (at least the first time).

So you need to hard-code the password in your script. You can give the password to pscp with its -pw option. But, I do not know how safe this is (at least in Linux, all user normally can see the command line of all processes).

share|improve this answer

EDIT following the update of the question:

The easiest way to copy files over network is probably SMB/CIFS - on Linux side you'd use SAMBA to either provide network share for Windows or to mount sharres exported by the Windows machine.

If you want to use ssh a look at PuTTY, which includes command line scp, that should be able to use key authentication. But then again: is it acceptable in your situation to use keys not protected with a password?

share|improve this answer

Since you don't want to type passwords or generate keys, I suggest the following:

  1. disable networking on both machines (security first!).
  2. enable password-less login on both machines.
  3. insert a floppy disk into machine A and copy the files onto the floppy.
  4. remove the floppy from machine A and walk to machine B.
  5. insert the floppy into machine B and copy the files onto machine B.

If you happen to have a Win 95 machine then you'll be excited to know that this is the networking model for which it was designed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.