Config
#struct ConfigThe configuration of an SFTP server.
| Name | Type | Description |
|---|---|---|
host | str = "0.0.0.0" | The address to listen on; 0.0.0.0 means every interface. |
port | int = 22 | The port to listen on; 22 by default, and 0 lets the system choose one. |
root | str = "." | The directory the clients see as /; nothing above it can be reached. |
host_key_file | str = "" | The path of the OpenSSH private key that is the identity of the server. |
users | Vector<sshd.User> | The users who may log in, as sshd.User values. |
import sftpd
import sshd
func main:
mut cfg := sftpd.NewConfig()
println cfg.host, cfg.port, cfg.root
println cfg.host_key_file == "", cfg.users.Len()
cfg.root = "/srv/drop"
cfg.users.Push(sshd.User { name = "partner", password = "s3cret", home = "/" })
println cfg.root, cfg.users.Len(), cfg.users.Get(0).name
end0.0.0.0 22 . true 0 /srv/drop 1 partner