samedi 31 janvier 2015

Why I cannot SSH as root into my android?


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




Aucun commentaire:

Enregistrer un commentaire