[erlang-questions] SFTP Server and state

Leonard B leonard.boyce@REDACTED
Fri Jun 8 15:03:15 CEST 2018


Hoping someone has done something similar before and can point me in
the right direction.

I'm looking to implement a virtual file system behind sftpd using a
custom file handler.

This is all well and good, as you can easily specify the subsystem using
{subsystems, ssh_sftpd:subsystem_spec([{file_handler, my_file_handler}])}

Where I'm running into an issue is that there appears to be no way to
connect the subsystem to the auth handler

If I specify pwdfun I can handle my DB based auth without issue, but
the file subsystem has no access to the data.

Reading the code for ssh_sftp:init/1 it appears that the
{ssh_sftpd_file, _} option can accept a tuple of {module,
FileHandlerState}.

The issue I have is how to get the `pwdfun` state (optional return)
into the file subsystem.

Any pointers would be great.

Thanks,
Leonard



More information about the erlang-questions mailing list