QuickSSHd (Dropbear/SSH) won’t run under Android Jelly Bean

I run SSHd on my Android phone. This means I can copy files via wireless SFTP, and back it up with BackupPC. It beats using USB or Dropbox. With Android 4.1 and up (Jelly Bean), the default umask for files has changed from “000” (users/programs can write to nearly any file) to “077” (users/programs can only write to files they own). This is better, but meanwhile many Android programs expect the old behaviour. QuickSSHd (a 99p Android dropbear SSH server) is one of them.

This is really just a user interface bug. QuickSSHd is still starting dropbear, it just can’t read the server PID file to verify that it is running. The workaround is to rename the “dropbear” binary in /data/data/com.teslacoilsw.quicksshd/dropbear/, and replace it with a script which adjusts the umask before calling the real dropbear.

So start QuickSSHd once, and ignore the appearance that it’s not running. Then login as root (or use su in a terminal) and run:

cd /data/data/com.teslacoilsw.quicksshd/dropbear/
cp -a dropbear dropbear.real
cat > dropbear << END_OF_LINE
#!/system/bin/sh
umask 000
/data/data/com.teslacoilsw.quicksshd/dropbear/dropbear.real "$@"
END_OF_LINE

The cp -a ensures that the new dropbear script is owned by the right user and have the right permissions. If not, you will need to use chown and chmod to fix it. The right user/group will be different on each Android device, and the permissions should be the same as the original dropbear (now dropbear.real).

After applying this fix, you will need to reboot your phone, or kill the running dropbear using ps and kill. After that, QuickSSHd should work as normal.

Tags: ,

  1. Christophe Gevrey’s avatar

    Thanks for your detailed instructions.
    My experience:
    There is no “cp” available, so I did a “mv dropbear dropbear.real”
    Then I created a new “dropbear” script (using WinSCP connected to my Android)
    I copied the 3 lines in the script.
    With WinSCP I changed the permissions of the script to make it executable, et voilĂ !

    Reply

    1. Tyler Wagner’s avatar

      Wow. What software release on what phone? Building busybox without “cp” is insane.

      Thanks for the instructions. Others will thank you.

      Reply

    2. Christophe Gevrey’s avatar

      I have an Android 4.1.2 on a Galaxy S3 I-535 Verizon.

      Reply

    3. Ed’s avatar

      Thanks! This is helpful.

      Reply

    4. Tom’s avatar

      Thank you.

      Reply

    5. Mes’s avatar

      Thanks. Nexus 4 KK-KRT16S

      Reply

Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.