2

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?

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

  • 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 Aug 23 '18 at 6:29
  • btw i run the pscp.exe command in windows cmd right? not ssh terminal – user935892 Aug 23 '18 at 6:35
  • 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 Aug 23 '18 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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