OpenWrt Forum Archive

Topic: Sftp

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have followed the steps here http://www.macsat.com/macsat/content/view/37/30/ to install openssh-sftp-server.
Everything went fine but it didn't work, when the protocol is set to SFTP the error in winscp is:

Cannot initalize SFTP protocol. Is the host running a SFTP server?
Connection has been unexpectedly closed. Server sent command exit status 127

logread -f shows:

Sep  7 15:41:24 (none) kern.info dropbear[987]: Child connection from x.x.x.x:60555
Sep  7 15:41:25 (none) kern.notice dropbear[987]: password auth succeeded for 'root' from x.x.x.x:60555
Sep  7 15:41:25 (none) kern.info dropbear[987]: exit after auth (root): received data with bad writefd

or

Sep  7 15:40:32 (none) kern.info dropbear[981]: Child connection from x.x.x.x:60537
Sep  7 15:40:33 (none) kern.notice dropbear[981]: password auth succeeded for 'root' from x.x.x.x:60537
Sep  7 15:40:33 (none) kern.info dropbear[981]: exit after auth (root): Exited normally

When setting the protocol to scp, I can log in after displaying some errors. Any idea?

Thanks

WL500gp

Ok solved this already. The reason was that libopenssl, zlib packages were installed to /opt (usb). I had to add few synlinks:
ln -s /opt/usr/lib/libcrypto.so.0.9.7 /usr/lib/libcrypto.so.0.9.7
ln -s /opt/usr/lib/libz.so.1 /usr/lib/libz.so.1

I have followed this nice guide http://www.macsat.com/macsat/content/view/16/30/ and added export LD_LIBRARY_PATH=/lib:/usr/lib:/opt/usr/lib:/opt/lib to /etc/profile and rebooted to avoide this problem but didn't help.

Anything wrong?

Commands in /etc/profile are executed when you login, so if you login and start a program which needs a library in /opt/usr/lib it will work.
But the sftp-server is started by dropbear which in turn was started by one of the init scripts, which simply don't know of or care about /etc/profile.

ok, it's clear, why it doesn't work. But I'm looking for a solution, I don't have to solve for each package. What I'm looking for is a possibility to set path as well as ld_library_path at boot-time and therefore for all processes. That sounds total easy, but I haven't found a solution.

if that doesn't work with a symlink from /opt , that is because /opt is not mounted before sftp server sarted...

so mount your /opt before wink

The discussion might have continued from here.