sftp

package module
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: ISC Imports: 32 Imported by: 0

README

SFTP Integration

Overview

SFTP (SSH File Transfer Protocol) is a secure file transfer protocol that operates over SSH, providing encrypted access to files on remote servers. It is commonly used in server administration, enterprise storage solutions, and legacy systems for file exchange.

This integration allows:

  • Seamless backup of files hosted on SFTP servers into a Kloset repository: Capture and store entire directory trees or specific remote paths from SFTP servers with full metadata, enabling secure and consistent backups across environments.

  • Direct restoration of snapshots to remote SFTP destinations: Restore previously backed-up snapshots directly to SFTP servers, preserving file hierarchies, permissions, and timestamps.

  • Compatibility with secure remote environments and legacy systems: Supports a wide range of remote servers, from modern cloud-hosted Linux instances to older on-premise infrastructure relying on SSH-based access.


Configuration

The supported configuration options are:

  • location: remote server hostname or IP
  • username: SSH username (optional if included in location)
  • identity: path to SSH private key file
  • host_key: SSH host public key for verification (e.g., example.com ssh-rsa AAAAB3NzaC1yc2E...)
  • insecure_ignore_host_key: disable host key verification (dangerous; use only for testing)
  • ssh_auth_sock: path to SSH agent socket (not supported on Windows)
  • ssh_private_key: SSH private key material to load into ssh-agent
  • ssh_private_key_ttl: TTL for ssh-add (default: 5s)
  • set_owner: set file owner and group on restore (requires superuser permissions)

It relies on the sftp executable and will use the user-configuration for additional options.


Examples

# back up a remote path over SFTP
$ plakar backup sftp://user@host/var/www

# restore the snapshot "abc" to an SFTP server
$ plakar restore -to sftp://user@host/var/www abc

# create a kloset repository on a remote SFTP server
$ plakar at sftp://user@host/backups create

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(endpoint *url.URL, params map[string]string) (*sftp.Client, error)

Must be public. Called externally from VSS integration.

func NewExporter

func NewExporter(ctx context.Context, opts *connectors.Options, name string, config map[string]string) (exporter.Exporter, error)

func NewImporter

func NewImporter(ctx context.Context, opts *connectors.Options, name string, config map[string]string) (importer.Importer, error)

func NewStore

func NewStore(ctx context.Context, name string, config map[string]string) (storage.Store, error)

Types

type Sftp

type Sftp struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, opts *connectors.Options, name string, config map[string]string, kind string) (*Sftp, error)

func (*Sftp) Close

func (s *Sftp) Close(ctx context.Context) error

func (*Sftp) Create

func (s *Sftp) Create(ctx context.Context, config []byte) error

func (*Sftp) Delete

func (s *Sftp) Delete(ctx context.Context, res storage.StorageResource, mac objects.MAC) error

func (*Sftp) Export

func (s *Sftp) Export(ctx context.Context, records <-chan *connectors.Record, results chan<- *connectors.Result) (ret error)

func (*Sftp) Flags

func (s *Sftp) Flags() location.Flags

func (*Sftp) Get

func (*Sftp) Import

func (s *Sftp) Import(ctx context.Context, records chan<- *connectors.Record, results <-chan *connectors.Result) error

func (*Sftp) List

func (s *Sftp) List(ctx context.Context, res storage.StorageResource) ([]objects.MAC, error)

func (*Sftp) Mode

func (s *Sftp) Mode(ctx context.Context) (storage.Mode, error)

func (*Sftp) Open

func (s *Sftp) Open(ctx context.Context) ([]byte, error)

func (*Sftp) Origin

func (s *Sftp) Origin() string

func (*Sftp) Ping

func (s *Sftp) Ping(ctx context.Context) error

func (*Sftp) Put

func (s *Sftp) Put(ctx context.Context, res storage.StorageResource, mac objects.MAC, rd io.Reader) (int64, error)

func (*Sftp) Root

func (s *Sftp) Root() string

func (*Sftp) Size

func (s *Sftp) Size(ctx context.Context) (int64, error)

func (*Sftp) Type

func (s *Sftp) Type() string

Directories

Path Synopsis
cmd
exporter command
importer command
storage command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址