freeasabeer

linux tools coming to MCR

Recommended Posts

freeasabeer    0

I've just uploaded a zip binary for our Hero: enjoy !

With regards to htop and Fn keys: within ConnecBot the Fn key is emulated by clicking the trackball and the the corresponding numeric key.

Edit: Paul how can you be faster than me to announce what I have uploaded ?? :)

Edited by freeasabeer

Share this post


Link to post
Share on other sites
freeasabeer    0

Busybox 1.16.0 has been released today and is now packaged as an modaco update.zip : update_busybox_for_mcr_0.2-signed.zip !

Share this post


Link to post
Share on other sites
Andcr    0

local rsync works fine but when I try to rsync my phone to my server over ssh I am doing something wrong..

rsync -avhi 'ssh -p 3487' /sdcard/Files/ [email protected]:/mnt/Backup/

then I get:

rsync: Failed to exec ssh: No such file or directory (2)

hope someone has a tip for me ;)

thanks in advance.

Share this post


Link to post
Share on other sites
freeasabeer    0
local rsync works fine but when I try to rsync my phone to my server over ssh I am doing something wrong..

rsync -avhi 'ssh -p 3487' /sdcard/Files/ [email protected]:/mnt/Backup/

then I get:

hope someone has a tip for me ;)

thanks in advance.

Did you install rsync by applying update_rsync_for_mcr_0.3-signed.zip from the recovery boot menu ?

If yes, then you should have ssh in /system/xbin as a symlink to dropbear.

Share this post


Link to post
Share on other sites
XVilka    0

Hm, may be you can write short article "howto building busybox and other linux tools on android"

It can be a very useful :-)

And each other, who was build some application, can add information about this process.

Share this post


Link to post
Share on other sites
Andcr    0
Did you install rsync by applying update_rsync_for_mcr_0.3-signed.zip from the recovery boot menu ?

If yes, then you should have ssh in /system/xbin as a symlink to dropbear.

applied the update again (must have been lost while flashing ;) )

now I get:

ssh: exited: Unknown own user

on my Ubuntu getting rsync and ssh to run was easy but with this I will learn a lot :D

Share this post


Link to post
Share on other sites
freeasabeer    0
now I get:

ssh: exited: Unknown own user

Ah, interesting !

This is something I didn't came across as I also have screen installed and with the screen package you got a /etc/passwd file that defines the root user...

So looks like we also need a valid /etc/passwd for rsync (well, ssh).

Here is a work around:

- create a file on your PC called passwd that contains the following line:

root::0:0:root:/data/local:/system/xbin/ash


- adb remount

- adb push passwd /system/etc/passwd

- adb shell chmod 644 /system/etc/passwd

Share this post


Link to post
Share on other sites
Andcr    0

thanks for the reply!

I already tried creating the passwd file manually but now I did exactly as you said but I still get:

ssh: exited: Unknown own user

I'm using the SUFBS terminal, dunno if this matters

I get the same message when just typing:

ssh

I can see the passwd file in the /system/etc dir and it's chmodded 644

Share this post


Link to post
Share on other sites
Morgoth6    0

Updated busybox failed to install on my Box (MCR 3.1.1) when creating symlinks. I wonder as I can see you delete symlinks using:

delete SYSTEM:xbin/[[

But they are create using:

symlink busybox SYSTEM/xbin/[[

Is this correct ? I guess it should be SYSTEM:xbin/[[, but Im definitly new here and I doesn't know the format of the update script yet.

Share this post


Link to post
Share on other sites
freeasabeer    0
I'm using the SUFBS terminal, dunno if this matters

Are you root or not inside SUBFS terminal ? I would say no... hence the "ssh: exited: Unknown own user"

Once you are in SUBFS terminal (or any other terminal application) you need to be root, so just type su to start a root shell and then start to play with rsync, ssh and co ;)

Share this post


Link to post
Share on other sites
Andcr    0
Are you root or not inside SUBFS terminal ? I would say no... hence the "ssh: exited: Unknown own user"

ah yes, forest... trees...

missed that one ;)

thanks a lot

ssh works fine now

now I'll have to look into getting the key authentication working, gonna go google it up

on my Ubuntu box it was simply creating a .ssh dir and adding an id_rsa and putting the public key in authorised_keys on my ssh server

but on my Hero I can't seem to create the .ssh dir under / or /root as it says "read-only"

I also can't mount -u / or /root because it isn't found in /etc/fstab

honestly, this is driving me crazy :D

I want to thanks you again for bringing rsync to Android, for me this is a dream come true!!

and also thanks for all the help!

Linux is great but there is so much to learn and it takes time :(

Share this post


Link to post
Share on other sites
freeasabeer    0
now I'll have to look into getting the key authentication working, gonna go google it up

on my Ubuntu box it was simply creating a .ssh dir and adding an id_rsa and putting the public key in authorised_keys on my ssh server

but on my Hero I can't seem to create the .ssh dir under / or /root as it says "read-only"

I also can't mount -u / or /root because it isn't found in /etc/fstab

maybe I forgot to mention it... you should put your pub key in /data/dropbear/.ssh/authorized_keys

Edited by freeasabeer

Share this post


Link to post
Share on other sites
freeasabeer    0
Updated busybox failed to install on my Box (MCR 3.1.1) when creating symlinks. I wonder as I can see you delete symlinks using:

delete SYSTEM:xbin/[[

But they are create using:

symlink busybox SYSTEM/xbin/[[

Is this correct ? I guess it should be SYSTEM:xbin/[[, but Im definitly new here and I doesn't know the format of the update script yet.

Oh my dear !!! I've updated busybox 1.16.0 update zip ;)

Share this post


Link to post
Share on other sites
mindsocket    0

rsync is fantastic! Thanks for this!

Any chance of a statically linked bash? The default shell drives me nuts.

I tried to do it myself using this page as a reference and managed to get a couple of compiled versions on to the phone, but neither worked. Error was:

bash: 1: Syntax error: ")" unexpected

Share this post


Link to post
Share on other sites
Morgoth6    0
Oh my dear !!! I've updated busybox 1.16.0 update zip ;)

It seems there is one more problem which would make phone unbootable in case someone try to update busybox from your unofficial 0.1 package to this version. The /etc/recolv.conf file would be already present if someone installed previous version and makelink would fail and left system in unusable state (Almost all command deleted by previous part of the script) This problem will nor occur in case of clean install as resolv.conf would be missing and script would be fine in this case. I think you should delete resolv.conf if exists before creant link in /etc.

Share this post


Link to post
Share on other sites
freeasabeer    0
Any chance of a statically linked bash? The default shell drives me nuts.

Which default shell ? Android's one (/system/bin/sh) ? Or busybox's one (/system/xbin/ash) ?

For the former, I agree it is pain. For the latter one IMHO it is quite good and enough for our usage: it provides shell completion (tab key) , command line history, etc...

So I don't really see the need for bash here.

Having said that, I do have a static build of bash ready just waiting to be used ;) I just didn't publish it because I didn't see a real need for it... but if there are some customer for bash, I'll make it available.

Share this post


Link to post
Share on other sites
freeasabeer    0
Where you get sources of midnight commander without glib?

I didn't as there are no such sources.

The midnight commander I do provide embbeds glib.... and all other resquired libs that mc relies on.

Share this post


Link to post
Share on other sites
freeasabeer    0
It seems there is one more problem which would make phone unbootable in case someone try to update busybox from your unofficial 0.1 package to this version. The /etc/recolv.conf file would be already present if someone installed previous version and makelink would fail and left system in unusable state (Almost all command deleted by previous part of the script) This problem will nor occur in case of clean install as resolv.conf would be missing and script would be fine in this case. I think you should delete resolv.conf if exists before creant link in /etc.

I'm affraid you're right.

Really this update-script mechanism is a pain when it comes to play with things like that. I need to think of another way to install/update the linux tools taht would be straight forward for the end-user and easy and powefull for the developper.

Share this post


Link to post
Share on other sites
Andcr    0

allright thanks to freeasabeer and some research I got ssh running with key authentication

I documented it a little for myself for future reference and thought I'd post it here in case someone needs it

Create /etc/passwd file if you don't have it already (needed to run ssh):

http://android.modaco.com/content-page/299...cr/page/99/#100 post #108

	adb shell

	echo root::0:0:root:/data/local:/system/xbin/ash > /system/etc/passwd

	chmod 644 /system/etc/passwd
Create private/public keys: http://forum.dsmg600.info/t529-without-password....html post#7
	adb shell

	mkdir /data/dropbear/.ssh

	cd /data/dropbear/.ssh

	dropbearkey -t rsa -f key

	dropbearkey -f key -y | head -n2 | tail -n1 > key.pub
or if you want a different keysize than the default -s bits Set the key size to bits bits, should be multiple of 8
	dropbearkey -t rsa -f key -s 2048
Copy public key from your Android phone to the server:
	scp /data/dropbear/.ssh/key.pub [email protected]:/tmp
Login on your server from a device that already has access and add the public key to the authorized_keys: in case of a user:
	cat /tmp/key.pub >> /home/user/.ssh/authorized_keys
in case of root:
	cat /tmp/key.pub >> /root/.ssh/authorized_keys
Connect to to your server from you Android phone using your newly created key: if you use the default port for ssh (22):
	ssh -i /data/dropbear/.ssh/key [email protected]
or if you use a different port for ssh:
	ssh -p 7823 -i /data/dropbear/.ssh/key [email protected]

General info:

http://linux-tips.org/article/66/dropbear-rsa-key-problem

Dropbear doesn't lookup users .ssh directory for user's private key. You should expicitly say which private key will be used for session with the -i parameter.

http://minimalinux.org/ttylinux/Documents/multi/node33.html

The SSH client program is called dbclient. It is different from the server in that it cannot use keys in OpenSSH format. You can use the dropbearconvert program to convert an OpenSSH format key for use by dbclient or you can use dropbearkey to create a new key.

Edited by Andcr

Share this post


Link to post
Share on other sites
Andcr    0

so now ssh works but when I try to rsync over ssh it doesn't feel like working so I must be missing something (again ;) )

my command is:

rsync -avhi 'ssh -p 7823 -i /data/dropbear/.ssh/key' /sdcard/Files/Backup [email protected]:/data/Backup
but now I get the message:
ssh: exited: Error connecting: Connection refused

it is done as su because I put it in a script for SUFBS

any ideas? :D

Share this post


Link to post
Share on other sites
freeasabeer    0
so now ssh works but when I try to rsync over ssh it doesn't feel like working so I must be missing something (again ;) )

my command is:

rsync -avhi 'ssh -p 7823 -i /data/dropbear/.ssh/key' /sdcard/Files/Backup [email protected]:/data/Backup
but now I get the message:
ssh: exited: Error connecting: Connection refused

it is done as su because I put it in a script for SUFBS

any ideas? :D

From your command line I guess that you are trying to connect to 192.168.1.1 from your hero, and 192.168.1.1 has a ssh server set-up that listen on port 7823. On top of that, you want to use your hero private key that is stored in /data/dropbear/.ssh/key

Am I correct ?

Now, from the error message I would say that 192.168.1.1 does not allow ssh connection on 7823 or does not allow key authentication.

Btw, shouldn't the key file be named id_rsa.db instead of key? Another check: are /data/dropbear/.ssh permissions set to 700 and /data/dropbear/.ssh/key to 600 ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.