-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scp example requires -O flag with openssh 9.0 #40
Comments
definitely something to look into, thanks for reporting! |
something to look at: https://github.com/pkg/sftp |
Happy to submit a PR, it's still a WIP, but we have a working version at pico.sh: https://git.sr.ht/~erock/wish/tree/main/item/send/send.go#L11 |
ah, amazing @neurosnap , would be neat! Don't need to worry too much, I can finish what you started :) thanks! |
found a 2024 url for picosh/send sftp: https://github.com/picosh/send/blob/41432db245e0a519290e1e38442dc16cbc0fe802/send/sftp/sftp.go#L50 |
while I can't repro the original issue here, if you need sftp, you can do something like: s, err := wish.NewServer(
wish.WithAddress(fmt.Sprintf("%s:%d", host, port)),
wish.WithHostKeyPath(".ssh/term_info_ed25519"),
func(s *ssh.Server) error {
s.SubsystemHandlers = map[string]ssh.SubsystemHandler{
"sftp": func(s ssh.Session) {
log.Info("using sftp")
srv, err := sftp.NewServer(s, sftp.WithServerWorkingDirectory("/tmp/dir"))
if err != nil {
wish.Fatalln(s, err)
}
if err := srv.Serve(); err == io.EOF {
if err := srv.Close(); err != nil {
wish.Fatalln(s, err)
}
} else if err != nil {
wish.Fatalln(s, err)
}
},
}
return nil
},
wish.WithMiddleware(
scp.Middleware(handler, handler),
),
) |
This would allow users to more easily provide both SCP and SFTP servers to their users. closes #40 Signed-off-by: Carlos Alexandro Becker <[email protected]>
also #224 should make it easier to do so: |
* feat: better integration with pkg/sftp This would allow users to more easily provide both SCP and SFTP servers to their users. closes #40 Signed-off-by: Carlos Alexandro Becker <[email protected]> * test: fix Signed-off-by: Carlos Alexandro Becker <[email protected]> * test: add tests Signed-off-by: Carlos Alexandro Becker <[email protected]> * feat: sftp refactory * fix: aymans suggestions Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: aymans suggestions Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: make sftp an example instead Signed-off-by: Carlos Alexandro Becker <[email protected]> * chore: update docs * fix: tests Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: unexport Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: unexport Signed-off-by: Carlos Alexandro Becker <[email protected]> --------- Signed-off-by: Carlos Alexandro Becker <[email protected]>
Greetings!
Love the library and everything you all are working towards!
openssh v9 just released which changes the default protocol for scp https://www.openssh.com/txt/release-9.0
The current scp example does not work unless specifying the -O flag.
It seems like anyone that wishes to implement an scp server now needs to support both: legacy scp and sftp.
I wanted to surface that potential issue here as well as ask a general question about implementation.
I'm probably going to start working on adding sftp support to scp but wondered if you all had any advice on how to best implement it? Happy to send whatever I come up with upstream.
Thanks!
The text was updated successfully, but these errors were encountered: