OpenWrt Forum Archive

Topic: anyone using scp?

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

For various reasons, I decided to go with OpenSSH rather than dropbear on my build.  To do this, I added zlib openssl openssh to OPENWRT_TARGETS in openwrt.mk.  It built great, and after creating passwd, group, and shells like the dropbear ipkg does, I can ssh in just fine.

But one of the reasons that I installed OpenSSH was to get scp.  It doesn't really seem to be working.  If I scp from a PC to the openwrt, it creates the file in the right location, but it is zero length.

Any idea what is going wrong or is missing?  Anyone else have scp working?

I am the one who modified those openssh patches to work in the buildroot for OpenWrt.

scp is fine but the uClibc has a bug. The ftruncate() function used by scp is not working. Thus scp copies a file to wrt and then truncates it to length 0. The ftruncate() is used by other programs but so rarely that this problem was missed.

andersee fixed the uClibc bug, I didnt have time yet to test it. It will be available shortly in th CVS.

...

Any idea what is going wrong or is missing?  Anyone else have scp working?

Yes, i have wink
I have modified dropbear.mk to compile a scp binary (in addition to the dropbear binary). It works (for me) with some of the dropbear .ipkgs floating around somewhere (i dont remember the version). If you like to give it a try - i have attached it as zip file.
You can upload it with nc (netcat) to your OpenWRT box.

HTH

Has anyone compiled up an ssh *client*?

I want to be able to ssh into the router and then ssh *from* the router to another box.

-- Rod

I have modified dropbear.mk to compile a scp binary...

He didnt want to use dropbear... and are you sure that dropbear scp does not use ftruncate() when copying to wrt?

Has anyone compiled up an ssh *client*?

OpenWrt CVS buildroot has a complete ssh package built-in. I made the changes required to build all openssh components including scp, ssh client, sftp, sftp-server etc. Simply include zlib, openssl and openssh in the PACKAGES variable and a series of .ipks will be built containing zlib, libssl, sshd, ssh etc.

Is there somewhere that I can get the patch for the uClibc bug?  I'd like to try to get scp up and running.

s there somewhere that I can get the patch for the uClibc bug

An OpenWrt-friendly version of the patch is in the CVS. The uClibc.mk automatically patches the library for it.

Also some fixes and cleanup were made to the OpenSSH package build system.

The discussion might have continued from here.