0

I am trying to sftp from my linux machine to a Windows host but I get connection refused.

[root@linux-host ~]# sftp my.user@windows-host
ssh: connect to host windows-host port 22: Connection refused.

However, if I try vice versa i.e. connecting to the linux host from the Windows host using psftp it works just fine:

PS C:\Users\my.user> psftp my.user@linux-host
Using username "my.user".
..
psftp> get /tmp/somefile somefile
remote:/tmp/somefile => local:somefile

Do sftp and psftp work on different ports? And if windows host can send file using pfstp doesn't that imply that it is also ready to receive through SFTP protocol?

My eventual aim is to be able to transfer files between Windows and linux host. Using SCP/PSCP isn't an options.

1
  • "And if windows host can send file using pfstp doesn't that imply that it is also ready to receive through SFTP protocol?" – Well, you have received somefile by using get, haven't you? From the context I understand you rather want your Windows to be a server. Still Windows as a client is ready to receive as well as to send. Aug 9, 2023 at 22:31

1 Answer 1

1

And if windows host can send file using pfstp doesnt it imply that it is also ready to receive through SFTP protocol?

No.

Windows can connect to your Linux PC for sftp purposes, because your Linux runs an SSH server (which contains the sftp server).

Linux cannot connect to your Windows PC for sftp purposes, because your Windows does not run such a service.

Solution:

  1. Either install an SSH server on your windows machine, or
  2. Use Windows file sharing and smbclient (or mount the share, or access it elsewise) from Linux.
2
  • I can use scp/pscp to achieve the same, so scp doesn’t require any specific setup but sftp does? Aug 9, 2023 at 22:24
  • 1
    The point is that the connection went the other direction. Aug 9, 2023 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .