rclone: github.com/ncw/rclone/cmd/serve/sftp Index | Files

package sftp

import "github.com/ncw/rclone/cmd/serve/sftp"


Package Files

connection.go handler.go server.go sftp.go


var Command = &cobra.Command{
    Use:   "sftp remote:path",
    Short: `Serve the remote over SFTP.`,
    Long: "" /* 1268 byte string literal not displayed */+
        vfs.Help + proxy.Help,
    Run: func(command *cobra.Command, args []string) {
        var f fs.Fs
        if proxyflags.Opt.AuthProxy == "" {
            cmd.CheckArgs(1, 1, command, args)
            f = cmd.NewFsSrc(args)
        } else {
            cmd.CheckArgs(0, 0, command, args)
        cmd.Run(false, true, command, func() error {
            s := newServer(f, &Opt)
            err := s.Serve()
            if err != nil {
                return err
            return nil

Command definition for cobra

var DefaultOpt = Options{
    ListenAddr:     "localhost:2022",
    AuthorizedKeys: "~/.ssh/authorized_keys",

DefaultOpt is the default values used for Options

var Opt = DefaultOpt

Opt is options set by command line flags

func AddFlags Uses

func AddFlags(flagSet *pflag.FlagSet, Opt *Options)

AddFlags adds flags for the sftp

type Options Uses

type Options struct {
    ListenAddr     string   // Port to listen on
    HostKeys       []string // Paths to private host keys
    AuthorizedKeys string   // Path to authorized keys file
    User           string   // single username
    Pass           string   // password for user
    NoAuth         bool     // allow no authentication on connections

Options contains options for the http Server

Package sftp imports 34 packages (graph). Updated 2020-05-26. Refresh now. Tools for package owners.