[openwrt] ash: /usr/libexec/sftp-server: not found scp: Connection closed

 

 scp luci-app-openclash_0.47.028_all.ipk root@10.10.2.3:/root

root@10.10.2.3's password:

ash: /usr/libexec/sftp-server: not found

scp: Connection closed

 

 

The error "ash: /usr/libexec/sftp-server: not found" followed by "scp: Connection closed" occurs because your client machine (the computer you are running the scp command from) is using a newer version of OpenSSH (typically v9.0 or later).

Newer OpenSSH clients use the SFTP protocol by default for scp transfers, but the OpenWrt router uses the lightweight Dropbear SSH server, which typically only supports the legacy SCP protocol and does not include the separate sftp-server binary required by the new clients.

You have two main solutions: the easy client-side fix or the OpenWrt package fix.


 

1. Easy Fix: Use the Legacy SCP Protocol (Recommended) ✅

 

The simplest and most immediate fix is to tell your client's scp command to fall back to the old, legacy SCP protocol by adding the -O (uppercase 'o') flag.

Your original command:

Bash
 
scp luci-app-openclash_0.47.028_all.ipk root@10.10.1.3:/root

The fixed command:

Bash
 
scp -O luci-app-openclash_0.47.028_all.ipk root@10.10.1.3:/root

This forces the client to use the older, universally supported SCP transfer method, which works with the default Dropbear server on OpenWrt.


 

2. OpenWrt Fix: Install the SFTP Server 📦

 

If you prefer to enable the newer SFTP protocol on your router (useful for graphical SFTP clients like WinSCP or FileZilla), you need to install the openssh-sftp-server package on your OpenWrt router.

  • Step 1: SSH into your OpenWrt router.

    Bash
     
    ssh root@10.10.1.3
    
  • Step 2: Update packages and install the SFTP server.

    (You must have a working internet connection for this.)

    Bash
     
    opkg update
    opkg install openssh-sftp-server
    

    If opkg update fails due to an SSL error, you may need to resolve that first (e.g., check your router's date/time) or temporarily use opkg update --no-check-certificate.

  • Step 3: Log out of the router and try your original scp command again.

    Bash
     
    exit
    scp luci-app-openclash_0.47.028_all.ipk root@10.10.1.3:/root
    

With the sftp-server package installed, your modern scp client will successfully find the necessary binary to complete the transfer using the SFTP protocol.

Next Step: Please try the -O flag fix first. Let me know if that works, or if you need assistance installing the package on your router.

 

posted @ 2025-11-04 06:21  profesor  阅读(8)  评论(0)    收藏  举报