Skip to content
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

sftp.NewClient returns "EOF" error #506

Open
mraxrorxon opened this issue May 16, 2022 · 4 comments
Open

sftp.NewClient returns "EOF" error #506

mraxrorxon opened this issue May 16, 2022 · 4 comments

Comments

@mraxrorxon
Copy link

I create sshClient like this:
if sshClient, err = ssh.Dial("tcp", addr, clientConfig); err != nil {
return nil, err
}; and sshClient is created successfully, after that create sftp client like this:

if sftpClient, err = sftp.NewClient(sshClient); err != nil {
return nil, err
} here I get an error "EOF"
Please help this, where is a problam?

@mraxrorxon mraxrorxon changed the title sftp.NewClient returns "EOF" erro sftp.NewClient returns "EOF" error May 16, 2022
@puellanivis
Copy link
Collaborator

Could you maybe share the whole of your function(s)? And encase it in a triple-backtick code block? There is not really enough information here to diagnose what might be going on.

@npsables
Copy link

npsables commented Jun 29, 2022

My problem was the section Subsystem in /etc/ssh/sshd_config of the target server was wrong or missing. Fixed by correcting this section then restart the service.

But to be honest, the error io.EOF returned is very confusing, maybe we should add diagnosis here?

func (c *Client) recvVersion() error {
	typ, data, err := c.recvPacket(0)
	if err == io.EOF {
		// do some diagnose here
		err = nil
	}
       ...
}

@puellanivis
Copy link
Collaborator

Hm… yeah, we could probably do something there, but there’s not much to diagnose at that point. If we get an EOF there, then we’re stuck in an unrecoverable state. However, we could use fmt.Errorf("problem receiving version packet: %w", err) or maybe even convert it to io.ErrUnexpectedEOF as well.

@npsables
Copy link

Yea, and maybe we should add some comments if someone has the same problem. Hope this help someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants