Key-identification with ssh-server and Android 4.1.1 ?

a2109a

Member
Dec 20, 2012
90
4
Device: LENOVO IdeaTabA2109A
Android Version: 4.1.1
Build: JRO03R.A2109A_03_13_121126_MCL0201

I tried to setup authorized_keys to connect to the ssh-server on my
IdeaTab A2109A following [Tutorial] Getting a SSH client and server working on CyanogenMod | TK Assembled

Unfortunately adb-commands did not work for me, could depend on my knowledge, but I think adb is not needed. Connection via ssh to the tablet should be an alternative.

I connected from my Ubuntu 12.04 via ssh to the ssh-server of the tablet ( https://play.google.com/store/apps/details?id=me.shkschneider.dropbearserver )

[Tutorial] Getting a SSH client and server working on CyanogenMod | TK Assembled

cd /
mkdir /data/dropbear/.ssh
ln -s /data/dropbear/.ssh /data/.ssh


No idea, why he does "cd /", but I did it. Then mkdir didn't work, so I did

[/QUOTE]

mkdir -p /data/dropbear/.ssh
[/QUOTE]

And maybe this is the problem, why key-identification didn't work at the end. Maybe the authorized_keys are expected at another place.

[Tutorial] Getting a SSH client and server working on CyanogenMod | TK Assembled

dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key

dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key


dropbearkey was not found, so there is a path problem. I have installed https://play.google.com/store/apps/details?id=com.spartacusrex.spartacuside and postinstalled System v1.95. Using the shell at the tablet, "which dropbearkey" told me, that it is found at "/data/data/com.spartacusrex.spartacuside/files/system/bin/dropbearkey"

So I did this to create the server keys:

/data/data/com.spartacusrex.spartacuside/files/system/bin/dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key

/data/data/com.spartacusrex.spartacuside/files/system/bin/dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key


[Tutorial] Getting a SSH client and server working on CyanogenMod | TK Assembled


chmod 755 /data/dropbear /data/dropbear/.ssh /data/.ssh

chmod 644 /data/dropbear/dropbear_*_host_key

/data/data/com.spartacusrex.spartacuside/files/system/bin/dropbearkey -t rsa -f /data/.ssh/id_rsa

/data/data/com.spartacusrex.spartacuside/files/system/bin/dropbearkey -y -f /data/.ssh/id_rsa | grep "^ssh-rsa" > /data/.ssh/id_rsa.pub

cat /data/.ssh/id_rsa.pub > /data/.ssh/authorized_keys

chmod 600 /data/.ssh/authorized_keys


Instead of using adb, I used vi and the clipboard to copy the key of my pc to /data/.ssh/authorized_keys

chmod 600 /data/.ssh/authorized_keys


I stopped the ssh-server and started it again and then I tried to login to the tablet via ssh from my pc and was asked for the password. So what is wrong?

ls -la /data/.ssh/
-rw------- root root 618 2013-01-06 15:09 authorized_keys
-rw------- root root 426 2013-01-06 15:03 id_rsa
-rw------- root root 228 2013-01-06 15:04 id_rsa.pub

ls -la /data/ssh/
drwx------ root root 2012-12-27 22:23 empty



It would be interesting what is configured in sshd_config, but the query rans for a very long time now and showed no result.

root@android:/ # find / -name sshd_config



My local pc:

~# grep authorized_keys /etc/ssh/sshd_config
#AuthorizedKeysFile %h/.ssh/authorized_keys
 
Last edited:

a2109a

Member
Dec 20, 2012
90
4
https://android.googlesource.com/pl...380bc5d2445788325e5092bd0/sshd_config.android
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile /data/ssh/authorized_keys

So the difference is a dot.

# ls -la /data/ssh/ drwx------ root root 2012-12-27 22:23 empty


# ls -la /data/.ssh/

-rw------- root root 618 2013-01-06 15:09 authorized_keys
-rw------- root root 426 2013-01-06 15:03 id_rsa
-rw------- root root 228 2013-01-06 15:04 id_rsa.pub

So I tried "ln -s" to link these 3 files and got "link failed File exists", but I could copy the files with cp

ls -la /data/ssh/

-rw------- root root 618 2013-01-06 16:21 authorized_keys
drwx------ root root 2012-12-27 22:23 empty
-rw------- root root 426 2013-01-06 16:22 id_rsa
-rw------- root root 228 2013-01-06 16:22 id_rsa.pub

No idea, what this file named empty is for.

I am still asked for the password to login.
 
Last edited:

a2109a

Member
Dec 20, 2012
90
4
Solved,

just copy your pulic_key of the pc to the internal sdcard and then import it with the SSH-Server-app at the menu. It looks like the standard place is ignored. I didn't find the key afterwards at /date/ssh/authorized_keys or /date/.ssh/authorized_keys. Before the import with the app I delete my public_key of the pc in both authorized_keys files. The app didn't allow me an import from an other place than the internal sdcard.
 
Top