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

Written by

in

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.

Comments

6 responses to “QuickSSHd (Dropbear/SSH) won’t run under Android Jelly Bean”

  1. Christophe Gevrey Avatar
    Christophe Gevrey

    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à!

    1. Tyler Wagner Avatar

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

      Thanks for the instructions. Others will thank you.

  2. Christophe Gevrey Avatar
    Christophe Gevrey

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

  3. Ed Avatar
    Ed

    Thanks! This is helpful.

  4. Tom Avatar
    Tom

    Thank you.

  5. Mes Avatar
    Mes

    Thanks. Nexus 4 KK-KRT16S

Leave a 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.