Table of Contents

SFTP server

Introduction

Goals

Instructions

The SSH File Transfer (SFTP) is a file transfer protocol that works over SSH. It's like SCP but has more features. For a basic usage the low level SCP may be enough but if you need, for example, to mount drive then use the SFTP.

The vanilla OpenWrt out of the box has a small Dropbear SSH server. But it doesn't support the SFTP and you need to install openssh-sftp-server package. The package comes from another OpenSSH server which is bigger but has more features and default on desktop systems like Ubuntu. Many routers with OpenWrt as a stock firmware use it out of the box and the openssh-sftp-server is installed too. So for this routers you really don't need anything to do and just start using it.

But if not then install the required package:

opkg update
opkg install openssh-sftp-server

Testing

Enter the following URL in your SFTP client.

sftp://root@openwrt.lan/

Clients

Troubleshooting

Collect and analyze the following information.

# Restart services
service log restart; service dropbear restart
 
# Log and status
logread -e dropbear; netstat -l -n -p | grep -e dropbear
 
# Runtime configuration
pgrep -f -a dropbear
 
# Persistent configuration
uci show dropbear
ls -l /etc/dropbear; cat /etc/dropbear/authorized_keys
ls -l $(opkg files openssh-sftp-server | grep -e ^/)

Extras

Service discovery

You may want to provide service discovery for clients supporting Bonjour/Zeroconf.

opkg update
opkg install announce

See also umdns Multicast DNS Daemon