Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-21-2017, 10:19 AM   #1
LQ Newbie
Registered: Nov 2017
Posts: 4

Rep: Reputation: Disabled
Transfer files with SFTP and PAGEANT : ? pscp.exe ? other ?


I would like to transfer files between servers.
Some are Linux Redhat and other are Windows WK8R2.
I need to :
# use SFTP
# use SSH key (ppk)
# only through a simple script like a batch (cmd)

I try many commands :

winscp.exe /ini=nul sftp://root@hostname /privatekey=path\file.ppk /script=path2\command_script.cmd /log=path3\log_file.log

winscp.exe /ini=nul /script=path2\command_script.cmd

...considering that the "command_script.cmd" include the path for the SSH Key (ppk), starting by a "open" Again, the script ask me to provide the user Root password. It seems that it doesn't recognize the PAGENT process

pscp.exe -sftp -agent root@hostname:/srv/*.txt M:\SERVER\

Here, the PAGEANT is running and the SSH Key (ppk) is declared with the good passphrase, too.

In any case, the error message is "Server refused our key".
I also try to putty with GUI, with the same SSH key (ppk), and it works.

Can you help me ?

Old 11-21-2017, 12:02 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
Transferring FROM Windows TO Linux (or UNIX) via sftp should work with WinSCP installed on the Windows system. If PuTTY works FROM Windows TO Linux then WinSCP should also.

Did you add the key FROM the Windows server to the $HOME/.ssh/authorized_keys of the target Linux server's user?
Old 11-23-2017, 07:15 AM   #3
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,355
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
cyrker this first post is fine.

Please do not add posts to other questions, referring to this one.


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
LXer: Transfer files securely with SFTP LXer Syndicated Linux News 1 11-21-2017 10:40 AM
Transfer files from Linux to Windows pscp vrecalde Linux - Newbie 10 01-09-2015 05:26 PM
SFTP cli and WinSCP metallica1973 Linux - Security 1 12-27-2013 09:07 PM
[SOLVED] Transfer files in sftp xeon123 Linux - Networking 7 12-17-2010 11:04 AM
Batch files to execute and transfer files via sftp cm67 Linux - General 5 08-13-2009 09:59 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 AM.

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
Open Source Consulting | Domain Registration