ssh_sftpd(3)
π¦ ssh_sftpd β bestie edition π¦
ok so this is the manual page for ssh_sftpd, from the Erlang module definitions (that's ssh_sftpd(3) for the citation girlies π
). It's one function. It's iconic. Let's go π
β¨ NAME β¨
ssh_sftpd β it specifies the channel process to handle an SFTP subsystem. that's it. that's the whole job. and it eats. π
πΈ DESCRIPTION πΈ
fr fr: it specifies a channel process to handle an SFTP subsystem. no notes, no crumbs, that's the vibe π«Ά
π« FUNCTIONS π«
subsystem_spec(Options) -> Spec π
here's the signature, verbatim, do not touch her:
subsystem_spec(Options) -> Spec
when
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().
okay so π this one is meant to be used together with ssh:daemon/[1,2,3] β like, they're a package deal, they don't go anywhere without each other π
The Name is "sftp" and CbMod is the name of the Erlang module implementing the subsystem using the ssh_server_channel behaviour (yes, it replaces ssh_daemon_channel β glow up era β¨).
π Options β the whole list, no skipping, we don't do that here
cwdβ sets the initial current working directory for the server. your starting point, your home base, your main character opening scene πfile_handlerβ decides which module gets called for accessing the file server. the default value isssh_sftpd_file, which uses thefileandfilelibAPIs to access the standard OTP file server. this option is literally there so you can plug in other file servers πΈmax_filesβ default value is0, which means there is no upper limit. if you do supply it, then the number of filenames returned to the SFTP client perREADDIRrequest is limited to at most the given value. set the cap, queen πmax_handlesβ default value is1000. a positive integer represents the maximum number of file handles allowed for a connection.
(note: a separate limitation might also be enforced by the underlying operating system π so like, you're not the only one making the rules here)
max_pathβ default value is4096. a positive integer represents the maximum path length which cannot be exceeded in data provided by the SFTP client.
(note: limitations might also be enforced by the underlying operating system π again, OS said "i also have opinions")
rootβ sets the SFTP root directory. must be an absolute path (e.g.,/tmp). 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. it's giving illusion of freedom, honestly π§
note: this provides application-level isolation. for additional security, consider using OS-level chroot or similar mechanisms. see the SFTP subsystem section in the Hardening guide for deployment recommendations. don't skip this part bestie, it's not a joke π«Ά
sftpd_vsnβ sets the SFTP version to use. defaults to5. version6is under development and limited. she's still cooking π₯
okay that's literally everything, every option, every default, every warning β nothing left behind, no crumbs, we ate and left no evidence π
this has been Ericsson AB energy, ssh 6.0.5 vibes, and the ssh_sftpd(3) manual page β periodt. stay encrypted, stay iconic, and go read your Hardening guide ππβ¨
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms