SFTP with DD-WRT

From DD-WRT Wiki

Revision as of 21:20, 21 January 2008 by Swift (Talk | contribs)
Jump to: navigation, search

SFTP with DD-WRT

Contents

Requirements

  • Although it wouldn't be too hard to make a firmware image that supports SFTP, you'll need a router with enough space to install Optware until someone does that.
  • You'll need access to Perl, either using the Optware package on your router or on another machine, to follow this tutorial exactly. You can substitute another utility that can edit binary files if you prefer.

Install the Packages

  1. Install the Optware Dropbear package.
ipkg-opt install dropbear
  1. Install the Optware SFTP server package.
ipkg-opt install openssh-sftp-server
  1. Configure /opt/etc/init.d/S51dropbear to set the Dropbear command line arguments you need.

Modify the Dropbear Executable

  1. If you don't have Perl installed on your router, copy /opt/sbin/dropbear to a machine that does have it. Regardless, make sure that you work with a copy in case something goes wrong.
  2. Modify the executable to use /opt/libexec/sftp-server instead of /usr/libexec/sftp-server.
perl -pi -e 's/\/usr\/libexec\/sftp-server/\/opt\/libexec\/sftp-server/g' dropbear
  1. Copy the modified Dropbear executable into /opt/sbin. (You can overwrite the existing /opt/sbin/dropbear since it's just a symbolic link to /opt/sbin/dropbearmulti.)

Test It

  1. Start the Dropbear server.
/opt/etc/init.d/S51dropbear start
  1. Attempt to connect with an SFTP client. It should work!