Hello,

I am using dropbear on Android phones to connect to each other. I am using
a cross-compiled single file binary of dropbear for Android. I am using the
"command=“ option in authorized_keys and also using the public key for
auth. The server when started from within my Android app is not allowing
the ssh connection to be successful. However, if I run the server from an
adb shell, the connection is successful and my command from authorized_keys
is executed like a charm.

Dropbear version: Dropbear v2017.75
My phone: Nokia 8.1 (Android 10)
Command to start the server: libdropbear.so -vFp 21210 -r .ssh/id_ecdsa
Location of authorized_keys:
/data/user/0/com.batnpad.appname.debug/.ssh/authorized_keys (Permission is
600)
Command used on the client side: ./libdbclient.so -yp 21210 -I 30 -i
../.ssh/id_ecdsa u0_a340@192.168.1.142
Output on the client side in case of failure: ./libdbclient.so: Connection
to u0_a340@192.168.1.142:21210 exited: Remote closed the connection

I checked the verbose server logs in both cases. To keep it concise, I will
only paste the lines with a difference:

Log from server started from within the app:
TRACE  (10836) 34.244358: enter checkfileperm(/data/user/0/)
TRACE  (10836) 34.244452: leave checkfileperm: success
TRACE  (10836) 34.244458: enter checkfileperm(/data/user/0//.ssh)
TRACE  (10836) 34.244469: leave checkfileperm: success
TRACE  (10836) 34.244473: enter
checkfileperm(/data/user/0//.ssh/authorized_keys)
TRACE  (10836) 34.244485: leave checkfileperm: success
TRACE  (10836) 34.244490: leave checkpubkeyperms


Log from server started from an adb shell:
TRACE  (10481) 8.908210: enter
checkfileperm(/data/user/0/com.batnpad.appname.debug)
TRACE  (10481) 8.908333: leave checkfileperm: success
TRACE  (10481) 8.908346: enter
checkfileperm(/data/user/0/com.batnpad.appname.debug/.ssh)
TRACE  (10481) 8.908359: leave checkfileperm: success
TRACE  (10481) 8.908381: enter
checkfileperm(/data/user/0/com.batnpad.appname.debug/.ssh/authorized_keys)
TRACE  (10481) 8.908396: leave checkfileperm: success
TRACE  (10481) 8.908402: leave checkpubkeyperms

I have been trying to solve this for days. Any pointers will be of great
help. Thanks.

Reply via email to