2

I set an public key auth SSH server in my rooted Note 4 through Dropbear (Terminal IDE). I am being able to log in as any user, except root. I get:

 [2085] Jan 31 20:05:21 exit after auth (root): child failed
 Connection to 192.168.nn.nn closed.

I've read that this is shell-related problem, but no idea which, or how to fix it. I want to log in as root since I get constant permission denied when trying to look at the /sdcard.

This is the script that starts the server:

#!/system/bin/sh

base="/data/data/com.spartacusrex.spartacuside/files"
dropbear=$base/system/bin/dropbear

id="1023"
gid="1028,1015"
username="gato"
w="-w"
if [ "$1" == "root" ]; then
    id=0
    gid=0
    username="root"
    w=""
fi

$dropbear \
    -A -N $username -U $id -G $gid \
    -C jtkkRKJ6993irJTjRJ993irJTj8496j \
    -d $base/.ssh/dropbear_dss_host_key \
    -r $base/.ssh/dropbear_rsa_host_key \
    -R $base/.ssh/authorized_keys \
    -F -E -s $w -g -p 22 &

These are the permissions in $base/.ssh:

 # ls -la .ssh
 drwx------    2 0        0             4096 Jan 28 23:43 .
 drwxrwxrwx   17 10223    10223         4096 Jan 31 22:25 ..
 -rw-------    1 0        0              382 Jan 28 23:43 authorized_keys
 -rw-------    1 0        0              458 Jan 28 23:43 dropbear_dss_host_key
 -rw-------    1 0        0              426 Jan 28 23:43 dropbear_rsa_host_key
 -rw-------    1 0        0             1798 Jan 28 23:43 known_hosts
  • are you sure dropbear itself is in fact running with root privileges? – mikky Jan 31 '15 at 23:37
  • @mikky: Well, it's being started by root itself after a su -. Remember that I can login as non root even with pubkeys. This is a shell problem. – Luis A. Florit Jan 31 '15 at 23:57
  • The error message suggests a permission problem - seems to me that dropbear cannot fork a shell with root permissions. I just tried your script and it works for me (root can log in) but I'm using dropbear installed via different app. Using CM11. – mikky Feb 1 '15 at 0:22
  • Mmmm... maybe it's that... I'll try to find another dropbear app. Thanks!! – Luis A. Florit Feb 1 '15 at 0:44
  • 1
    @tokland: I start dropbear with gid="1028". I can write and read the external SD card. I was unable to use it as root. – Luis A. Florit Jun 12 '15 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.