Replies: 1 comment
-
I don't have a lot of experience with sshfs and its For this to work, you'll want to make sure you pass in The biggest issue at the moment is that neither the Here's an example that seems to work for me here: import asyncio, asyncssh, sys
async def run_client() -> None:
async with asyncssh.connect('remotehost') as conn:
writer, reader, _ = await conn.open_session('sshfs : /tmp/mnt -o passive', encoding=None)
server = asyncssh.SFTPServer(writer.channel)
await asyncssh.sftp.run_sftp_server(server, reader, writer, 6)
try:
asyncio.run(run_client())
except (OSError, asyncssh.Error) as exc:
sys.exit('SSH connection failed: ' + str(exc)) This uses the standard There's a bit of ugliness here where you have to pass in a channel object when instantiating the SFTPServer object. This is normally hidden, and is used to allow access to environment variables set by the client when accepting connections as a (forward direction) SFTP server. It doesn't really make sense in this case, though. You may be able to just pass in Also, there's currently a requirement that you pass in the SFTP version to Let me know if this is what you were looking for... It turned out to be more straightforward than I expected! |
Beta Was this translation helpful? Give feedback.
-
I'm thinking about using asyncssh.SFTPServer (or SFTPServerHandler) as the server for 'reverse sshfs' (using sshfs -o passive). The main reason would be to restrict the set of files accessible to the remote system (like a chroot).
Can this implementation be connected to pipes, so that it could talk to an sshfs started remotely via ssh?
Beta Was this translation helpful? Give feedback.
All reactions