ssh_sftpd(3erl)
π ssh_sftpd β Erlang Module Definition π
okay so bestie, welcome to ssh_sftpd β this is the Erlang module definition for the SFTP subsystem situation, and honestly it's giving "small module, big responsibilities." let's get into it β¨
πΈ NAME πΈ
ssh_sftpd β literally specifies the channel process to handle an SFTP subsystem. that's the whole vibe. π«Ά
π¦ DESCRIPTION π¦
so like, this module specifies a channel process to handle an SFTP subsystem. no cap, that's what it does. it's the plug that makes SFTP happen over your SSH setup. π
β¨ EXPORTS β¨
π« subsystem_spec(Options) -> Spec
okay so first things first, the types, because we stay informed in this group chat:
Options =
[{cwd, string()} |
{file_handler, CbMod | {CbMod, FileState}} |
{max_files, integer()} |
{max_handles, integer()} |
{max_path, integer()} |
{root, string()} |
{sftpd_vsn, integer()}]
Spec = {Name, {CbMod, Options}}
Name = string()
CbMod = atom()
FileState = term()
this bad boy is meant to be used together with ssh:daemon/[1,2,3]. yes, the whole [1,2,3] arity moment β iconic, honestly. π
the Name is "sftp" and CbMod is the name of the Erlang module implementing the subsystem using the ssh_server_channel behaviour β and yes, that replaces ssh_daemon_channel, so don't come at me with the old one, iykyk. π
now the options, because there are a bunch and they all matter:
cwdβ sets the initial current working directory for the server. like, where you start. the starting point. the main character's origin story. πfile_handlerβ determines which module to call for accessing the file server. the default value isssh_sftpd_file, which uses thefileandfilelibAPIs to access the standard OTP file server. this option can be used to plug in other file servers. so like, bring your own file server if you want, bestie. π¦max_filesβ the default value is0, which means there is no upper limit. if supplied, the number of filenames returned to the SFTP client perREADDIRrequest is limited to at most the given value. so0is giving "no rules, just vibes," and anything else is giving "actually, let's put a cap on it." πΈrootβ sets the SFTP root directory. then the user cannot see any files above this root. if, for example, the root directory is set to/tmp, then the user sees this directory as/. if the user then writescd /etc, the user moves to/tmp/etc. yes, it's a whole illusion situation. the root is the root, periodt. πsftpd_vsnβ sets the SFTP version to use. defaults to5. version6is under development and limited. so like, v6 is still in its beta era β proceed accordingly. π
β οΈ heads up bestie: version 6 is under development and limited β that's straight from the source, don't @ me. π₯
that's the whole page, no missing details, no skipped options, we ate and left no crumbs π β¨
β with love from Ericsson AB, the ssh 4.15.3.1 era, dated ssh_sftpd(3erl) ππ«Άπ
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms