How can i copy using ssh scp from a linux folder to a windows folder?

2

1

Having problems copying the directory contents:

PC A: Linux pc with a folder containing images (/usr/share/a/images) PC B: Windows pc with a shared folder call B (192.168.1.2)

I'm using PC B, using putty to open a ssh session on PC A. entered the username and password and manage to get to the terminal

then i try to do the directory copy:

admin@abc-ace:~$ scp -r /usr/share/a/images 192.168.1.2:/B/
ssh: connect to host 192.168.1.2 port 22: Connection refused lost connection

anyone knows whats wrong? and is my command for scp wrong?

user935892

Posted 2018-08-21T06:56:37.367

Reputation: 61

Is B an SSH server as well? Please confirm you enter 192.168.1.2:/B/ and then 10.5.1.6 appears in the error message. – Kamil Maciorowski – 2018-08-21T07:02:30.090

1

See Transfer files to/from session I'm logged in with PuTTY.

– Martin Prikryl – 2018-08-21T07:02:50.830

@KamilMaciorowski should be both 192.168.1.2 sorry – user935892 – 2018-08-21T07:10:42.243

@KamilMaciorowski PC B no ssh server, just a shared folder "B' – user935892 – 2018-08-21T07:12:08.927

Answers

1

anyone knows whats wrong?

Your windows PC isn't an SSH server but client.

and is my command for scp wrong?

Your command would work if you would set up SSH server on Windows PC, but you don't actually need to do that if a task is just a copy content over SSH from Linux computer to Windows PC.

If you downloaded all programs that comes with PuTTY then there is program called PSCP.exe that you need to use on Windows PC for copy from remote machine to windows over SSH:

PSCP.EXE -r UserOnLinux@ip.of.linux.machine:/usr/share/a/images C:\Users\Public\Downloads

If you didn't downloaded all PuTTY package, then you can download PSCP.EXE here

Alex

Posted 2018-08-21T06:56:37.367

Reputation: 5 606

hi Alex, thanks for your reply, my intention is to first use putty to try out the commands for ssh, if it works, i will need to code the commands into my software using qt, so wondering if my coding is able to execute pscp.exe like the way u typed. – user935892 – 2018-08-23T06:29:10.697

btw i run the pscp.exe command in windows cmd right? not ssh terminal – user935892 – 2018-08-23T06:35:23.777

You can call pscp from any other program, not just from qt and yes you, should run pscp on windows side either from cmd console or call it via system call from your qt program – Alex – 2018-08-23T12:48:44.727