Replace Dropbear to OpenSSH + SFTP

The vanilla OpenWrt out of the box has a small Dropbear SSH server. But it doesn't support the SFTP and lacks of some other features. You can install 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. So for this routers you really don't need anything to do and just start using it.

  • Set a Dropbear's port to some unused (e.g. 2222) and restart it
    uci set dropbear.@dropbear[0].Port=2222
    uci commit dropbear
    /etc/init.d/dropbear restart
  • Ensure that the root user has a password by using the
    passwd

    command.

  • Reconnect to the SSH using the new port
    ssh root@192.168.1.1 -p 2222
  • Install OpenSSH server
    opkg update
    opkg install openssh-server
  • Allow root access
    sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
  • Enable it and start
    /etc/init.d/sshd enable
    /etc/init.d/sshd start
  • The OpenSSH now use the standard 22 port. Reconnect to SSH over the 22 port
    ssh root@192.168.1.1
  • Now you can disable the Dropbear
    /etc/init.d/dropbear disable
    /etc/init.d/dropbear stop
  • Install openssh-sftp-server package to support the SFTP protocol
    opkg update
    opkg install openssh-sftp-server
  • If needed, configure the OpenSSH server in /etc/ssh/sshd_config and restart it
    /etc/init.d/sshd restart
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/08/25 23:14
  • by dominicusin1