Search code examples
pythonsshsftptwistedsolaris

Can twisted SFTP-client work if the server does not allow SSH connection?


I have a Solaris 10 system, with Python 2.6.4, and I have to retrieve the files via the SFTP protocol, from the server, which does not allow the SSH logging in, i.e. only SFTP with RSA key is allowed. Could anyone please tell me:

  • is this possible at all?
  • is this possible with the above version of Python, or I need to upgrade it to 2.7.* work with the latest version of Twisted?

I have found this treat with the relevant information: twisted conch filetransfer And this one: Python Twisted: twisted conch filetransfer verifyHostKey But it is said there that Twisted first creates the SSH channel, and then establishes SFTP on top of it (forgive me for my possible misunderstanding and/or illiteracy), from the Twisted documentation:

Conch also provides an endpoint that is initialized with an already established SSH connection. This endpoint just opens a new channel on the existing connection and launches a command in that.

Will the same approach work in case you can not logging in via SSH? I.e. might it be possible to create an SSH channel if terminal SSH logging in is forbidden?

Are there any other approaches except Paramico, any other libraries that can help me in case of "No" to the above questions?


Solution

  • I know nothing about "Twisted". But I believe that you just have a terminology problem.

    which does not allow the SSH logging in, i.e. only SFTP with RSA key is allowed

    The above is nonsense. You cannot allow SFTP, but disallow SSH, because as you have already found in Twisted documentation, SFTP runs on top of SSH (this is true in general, that's nothing Twisted-specific).

    What your server most probably really "does not allow" is "shell" access. That's not the same as as SSH. So the server allows SSH, allows SFTP, but does not allow shell.