ssh_sftpd(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ¦‹ 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 is ssh_sftpd_file, which uses the file and filelib APIs to access the standard OTP file server. this option is literally there so you can plug in other file servers 🌸
  • max_files β€” default value is 0, which means there is no upper limit. if you do supply it, then the number of filenames returned to the SFTP client per READDIR request is limited to at most the given value. set the cap, queen πŸ‘‘
  • max_handles β€” default value is 1000. 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 is 4096. 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 writes cd /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 to 5. version 6 is 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