tjibbevanderlaan / chromeos-filesystem-sftp

ChromeOS app to access SFTP server
https://chrome.google.com/webstore/detail/shared-network-folder-sft/gbheifiifcfekkamhepkeogobihicgmn
BSD 3-Clause "New" or "Revised" License
80 stars 21 forks source link

Unable to init SFTP Session -21 11 #92

Closed ronald-willems closed 5 years ago

ronald-willems commented 9 years ago

Hi,

I am trying to use this app for my Synology. However, when I try to connect I run into the following error: Unable to init SFTP Session -21 11

Does anyone have a suggestion what might be the cause?

Kind regards, Ronald

yoichiro commented 9 years ago

@ronaldwillems74 The code -21 means LIBSSH2_ERROR_CHANNEL_FAILURE. That is, the ssh2 communication failed, I guess. I want to know more detail information. Could you give me the debug log on the Console tab of the DevTools by the following steps? https://github.com/yoichiro/chromeos-filesystem-sftp/wiki/How-to-Capture-the-Console-Log-of-DevTools

ronald-willems commented 9 years ago

I have some trouble capturing the complete log. Does this help: screenshot 2015-06-26 at 16 05 35

ronald-willems commented 9 years ago

One more thing. I'm trying to use this with my Synology NAS. ssh does not seem to be completely standard: BusyBox v1.16.1 (2015-05-11 02:52:35 CST) built-in shell (ash) Enter 'help' for a list of built-in commands.

DiskStation>

dkewley commented 9 years ago

I have a Synology DS213j that I have some (limited) success accessing from my Chromebook using this SFTP project. I've not been able to keep the SFTP connection alive long enough to do big transfers -- I'm not sure why yet, but I'll file another bug if I can track it down a bit. I found the SMB project by @yoichiro stayed connected for me much longer, but had problems with a file >2GB. In any event, I'm grateful that he has made these projects!

Like @ronaldwillems74, my Synology also has BusyBox v1.16.1, but that is just the command line shell, not the sshd (SSH service).

The sshd appears standard:

OpenSSH_6.6p2-hpn14v4, OpenSSL 1.0.1o-fips 12 Jun 2015

@ronaldwillems74: your sshd version string can be obtained by running sshd -V (sshd with a nonexistent option like -V prints the version and usage information).

Here's how you can get server-side ssh/sftp debugging info:

  1. ssh into the NAS as it appears you've already successfully done, so you get a command line shell session on the NAS
  2. in the NAS ssh command line shell window, run a new sshd session that listens on a different port, and prints debugging information into the foreground: /usr/bin/sshd -p 2222 -dd
  3. on your ChromeOS device, establish a new SFTP connection to your NAS, this time to port 2222
  4. capture any failure messages on the ChromeOS device, and capture the output of the sshd command from the NAS ssh shell window

When I did this, I also get the error message on the ChromeOS "Unable to init SFTP session -21 11". In the NAS shell window running sshd, the important messages appear to be:

debug1: session_input_channel_req: session 0 req subsystem debug2: subsystem request for sftp by user david debug1: skip sftp subsytem since sftp port is not matched subsystem request for sftp by user david failed, subsystem not found

Aha! That's helpful.

(Note: you probably have to cancel your special sshd by typing Ctrl-C in the ssh shell window.)

I went back to the NAS web GUI, opened its Control Panel, the File Services panel, and the FTP tab. Further down that page, there is an SFTP section. I have the checkbox checked to enable the SFTP service, with the port set to 22 (the standard ssh port).

Indeed, when I try an SFTP connection to port 22 (as usual; we just used 2222 for debugging), it mounts fine, first try. I remember I had to enable SFTP on the Synology when I first started playing with it last night.

I'm guessing you don't have SFTP enabled on your NAS -- see two paragraphs above for how to enable it. Let us know if that fixes it; if so, this issue can probably be closed.

ronald-willems commented 8 years ago

Hi,

Sorry for the late reply. The problem was indeed that I didn't have SFTP enabled. How foolish.. I didn't know it required an extra action...

Thanks a lot for your help. It works like a charm so far.

dkewley commented 8 years ago

@ronaldwillems74 : Good to know it works for you now! I don't think missing those buried details is foolish; it's not at all obvious.

Seems like this issue can be closed now.