{"record":{"id":"f66ee7a15926f63e","repo":"kubernetes/kops","slug":"error-creating-sftp-client-executing-sudo-usr-l","errorCode":null,"errorMessage":"error creating sftp client (executing 'sudo /usr/lib/openssh/sftp-server'): %w","messagePattern":"error creating sftp client \\(executing 'sudo /usr/lib/openssh/sftp-server'\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/sshfs.go","lineNumber":81,"sourceCode":"\t\treturn sftpClient, nil\n\t}\n\ts, err := p.client.NewSession()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating sftp client (in new-session): %w\", err)\n\t}\n\n\tstdin, err := s.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating sftp client (at stdin pipe): %w\", err)\n\t}\n\tstdout, err := s.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating sftp client (at stdout pipe): %w\", err)\n\t}\n\n\terr = s.Start(\"sudo /usr/lib/openssh/sftp-server\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating sftp client (executing 'sudo /usr/lib/openssh/sftp-server'): %w\", err)\n\t}\n\n\tc, err := sftp.NewClientPipe(stdout, stdin)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error starting sftp (executing 'sudo /usr/lib/openssh/sftp-server'): %w\", err)\n\t}\n\treturn c, nil\n}\n\nfunc (p *SSHPath) Path() string {\n\treturn \"ssh://\" + p.server + p.path\n}\n\nfunc (p *SSHPath) String() string {\n\treturn p.Path()\n}\n\nfunc (p *SSHPath) Remove(ctx context.Context) error {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/sshfs.go#L63-L99","documentation":"Returned by SSHPath.newClient when s.Start(\"sudo /usr/lib/openssh/sftp-server\") fails on the remote host after pipes were set up. The remote shell could not launch the sftp-server binary — sudo requires a TTY/password, the binary path doesn't exist on that distro, or the account lacks permission — so no SFTP channel can be created.","triggerScenarios":"Thrown at util/pkg/vfs/sshfs.go:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify /usr/lib/openssh/sftp-server exists on the target host (path differs on non-Debian systems)","Ensure the SSH user has passwordless sudo, or connect as root","Check the SSH session output for the remote shell's error message"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}