Context: In Remote per project containers snapcraft ssh’s into the LXD container to run sshfs inside in slave mode so that the project folder is mounted into the container, with an sftp-server running on the machine running snapcraft (as opposed to the default sshfs mode where the container would need to ssh into the snapcraft machine).
In lxd: Mount project folder via sshfs in case of a remote @sergiusens suggested to lazily install sftp-server with apt-get. Up until now snapcraft doesn’t install anything on the client machine, provided LXD is available from a snap or package.
snapcraft could depend on sftp-server in the case of a package and bundle sftp-server in the case of the snap.
We could install an sftp-server snap after creating and maintaining one, that works on non-Ubuntu systems.
We could lazily install sftp-server on Ubuntu only, until we have backends for other distros, and otherwise prompt the user to do it by hand.
We could just bail out with an error and tell the user to install a package.
To my mind, the first option, depending on and bundling respectively, seemed the easiest for us and the least annoying for the user of snapcraft… @elopio suggested to check the size impact of bundling sftp-seryer. I don’t know if there are other concerns with bundling it.