Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
sftp
✓ github.com/pkg/sftp
List files in the root directory over SFTP.
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
"github.com/pkg/sftp"
)
func main() {
config := &ssh.ClientConfig{
User: "user",
Auth: []ssh.AuthMethod{ssh.Password("pass")},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
conn, _ := ssh.Dial("tcp", "example.com:22", config)
client, _ := sftp.NewClient(conn)
defer client.Close()
files, _ := client.ReadDir("/")
for _, f := range files {
fmt.Println(f.Name())
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.13.10latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.