I've read a bunch of other similar questions, which suggest setting Subsystem sftp internal-sftp in sshd_config, which I did. I am able to connect to my remote machine via SSH normally, but SFTP fails to login. This all started when I set up Duo for 2-factor authentication on my server. When I enter sftp -v HostName corresponding to a host set up in ~/.ssh/config, the terminal hangs waiting for me to approve the login request on my phone. After that, the log prints a bunch of stuff.

The log shows that my key is accepted: Authentication succeeded (publickey)

Then it exits with Exit status 127. Here is the rest of the log output in case it is relevant.

debug1: Authentication succeeded (publickey).
Authenticated to ([]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2732, received 2572 bytes, in 5.5 seconds
Bytes per second: sent 493.6, received 464.7
debug1: Exit status 127
Connection closed

I would like to reiterate that this process of logging in to SFTP worked perfectly with keys before setting up Duo, but now only SFTP seems to be broken. Any ideas?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.