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: "" /* 1250 byte string literal not displayed */+
    Run: func(command *cobra.Command, args []string) {
        cmd.CheckArgs(1, 1, command, args)
        f := cmd.NewFsSrc(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
    Key            string // Path to private key
    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 32 packages (graph) and is imported by 2 packages. Updated 2019-07-24. Refresh now. Tools for package owners.