Use custom command to start SFTP server in pysftp/Paramiko

239 Views Asked by At

In WinSCP is an option to edit the SFTP server command/path (in the protocol options):

winscp image

Is there also such an option in pysftp/Paramiko or in an another SFTP package for Python?

Thanks!

1

There are 1 best solutions below

0
Martin Prikryl On BEST ANSWER

What that option in WinSCP does is that it runs SFTP over the "exec" channel, instead of the "sftp subsystem" channel. An (untested) equivalent in Python Paramiko:

ssh = paramiko.SSHClient()

# authenticate here

chan = ssh.get_transport().open_session()
chan.exec_command("/path/to/sftp-server")
sftp = paramiko.SFTPClient(chan)