Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:services:nas:sftp.server [2022/04/22 14:19] – [OpenSSH compatibility] colodocs:guide-user:services:nas:sftp.server [2023/03/04 11:21] – [Popular clients] stokito
Line 1: Line 1:
-====== OpenSSH compatibility ====== 
-As of OpenSSH 9.0, the standard openssh scp(1) client [[https://www.openssh.com/releasenotes.html#9.0|uses the SFTP protocol by default]], which is not provided by OpenWrt's standard ssh server, dropbear.  Invoke via ''scp -O'' to use the legacy scp/rcp protocol instead. 
- 
 ====== SFTP server ====== ====== SFTP server ======
-Some clients, e.gGNOME Files or [[https://cyberduck.io|Cyberduck]] on the Mac, [[https://trac.cyberduck.io/ticket/4161|do not support]] the scp/rcp protocol at all, only SFTP, so we need to install server-side SFTP support as an additional binary in /usr/libexec/sftp-server this can be done with:+{{section>meta:infobox:howto_links#basic_skills&noheader&nofooter&noeditbutton}} 
 + 
 +===== Introduction ===== 
 +  * This how-to describes the method for setting up [[wp>SSH_File_Transfer_Protocol|SFTP]] server on OpenWrt. 
 +  * It relies on [[docs:guide-user:base-system:dropbear|Dropbear]] and [[packages:pkgdata:openssh-sftp-server]] for secure authentication and file transfer. 
 +  * You can use any suitable [[docs:guide-user:services:nas:sftp.server#popular_clients|SFTP client]] running natively on your OS. 
 + 
 +===== Goals ===== 
 +  * Transfer files to/from the router. 
 +  * Secure file transfer operations. 
 +  * Support OS specific clients. 
 + 
 +===== 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 needfor example, to mount drive then use the SFTP. 
 + 
 +The vanilla OpenWrt out of the box has a small [[docs:guide-user:base-system:dropbear|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 [[docs:guide-user:installation:openwrt-as-stock-firmware|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:
  
 <code bash> <code bash>
Line 10: Line 29:
 </code> </code>
  
-Now you can use sftp clients such as GNOME Files or Cyberduck to connect to the OpenWrt system. Note that no additional startup scripts are required since all of that is handled by dropbear which is most likely already present on your system.+===== Testing ===== 
 +Enter the following URL in your SFTP client.
  
-===== Announce on the network ===== +<code bash> 
-If you would like to announce the service on the network using Bonjour/Zeroconf so that Cyberduck finds it, you you can install the announce package, starting from Chaos Calmer:+sftp://root@openwrt.lan/ 
 +</code> 
 + 
 +===== Troubleshooting ===== 
 +Collect and analyze the following information.
  
 <code bash> <code bash>
 +# Restart services
 +/etc/init.d/log restart; /etc/init.d/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 ^/)
 +</code>
 +
 +===== Extras =====
 +==== Popular clients ====
 +  * Windows: [[docs:guide-quick-start:sshadministration#winscp|WinSCP]] - an advanced GUI client. ''Proprietary''
 +  * Windows: [[https://www.farmanager.com/|FAR Manager]] - an advanced Norton Commander like file manager. Supports a plain SCP too. ''Proprietary''
 +  * Linux, macOS, FreeBSD: [[https://github.com/elfmz/far2l|far2l]] - an open source version of the FAR. ''GPL-2''
 +  * Linux, macOS, FreeBSD: [[https://midnight-commander.org/|Midnight Commander]] - a Norton Commander like file manager. Supports a plain SCP too. ''GPL-3''
 +  * Linux: [[wp>GNOME_Files|GNOME Files]] or [[https://apps.kde.org/ru/konqueror/|KDE Konqueror]]. ''GPL-2''
 +  * Linux: [[https://wiki.gnome.org/Apps/DejaDup/Details|GNOME Déjà Dup]] - a backup and sync tool. ''GPL-3''
 +  * Windows, macOS, Linux, FreeBSD: [[https://rclone.org/|rclone]] - a command-line program to manage files on cloud storage. ''MIT''
 +  * macOS: [[https://cyberduck.io/|Cyberduck]] and [[https://mountainduck.io/|MountainDuck]]. ''GPL-3''.
 +  * Android: [[https://play.google.com/store/apps/details?id=com.lonelycatgames.Xplore|X-plore File Manager]]
 +  * Android TV, RapberryPI: [[https://kodi.tv|KODI]] - a media player for TV. You can put a USB drive to a router and watch your photos, video and audio without any additional software.
 +  * [[https://www.sftp.net/clients|SFTP Client]] list
 +
 +==== Service discovery ====
 +You may want to provide service discovery for clients supporting Bonjour/Zeroconf.
 +
 +<code bash>
 +opkg update
 opkg install announce opkg install announce
 </code> </code>
-   
-The announce service will notice that openssh-sftp-server is present and will announce the sftp service on the network. 
  
 +See also [[docs:guide-developer:mdns|umdns Multicast DNS Daemon]]
  • Last modified: 2023/10/14 05:25
  • by vgaetera