2

I am running Android Revolution HD 52.0 custom ROM (Android 4.3) with Koush's superuser 1.0.3.0 on a Samsung Galaxy S3 GT-I9300.

In the hope of using some native shell applications on my phone for the purpose of backup and synchronization it with my GNU/Linux computers, I installed opkg from here: http://dan.drown.org/android/, and went on to install openssh and rsync. All of the new binaries are in /data/local/bin, and my own scripts are also in /data/local.

Using Jack Palevich's Android Terminal I am able to use rsync via ssh to push files onto my computers from my phone, but only when not logged in as root (ie when I haven't used the 'su' command).

When I run the scripts as root (after running su in the terminal emulator), I get the following error:

rsync: failed to exec ssh: Permission denied (13)

I get the same error message using adb shell + su.

The relevant line from the script is:

/data/local/bin/rsync --itemize-changes --verbose --human-readable \
--log-file=$local_path/log/nbbak-$(date +%F-%H-%M-%S).log \
--recursive --update --times --modify-window=1 \
--rsh="/data/local/bin/ssh -i $keyfile -p $port" \
$local_path/ $remote_path/ 

local_path is currently /storage/extSdCard. I have added the \ here for readability.

As I said, this operation (rsync put) works when using the script from Palevich's Terminal without su.

My questions are:

What is the problem? Is it about how Android assigns userids to processes? (As I understand it, new processes all run with their own userid. Is this what is happening here - is rsync not actually running as root, so it is not able to launch the ssh process as root either.) Or is something else going on? How could I troubleshoot this? I have tried running logcat, but don't know what I'm looking for.

What might the solution be with my current configuration?

I would like to run rysnc via ssh as root, as although it works in the terminal emulator without su, I am only able to push, not pull files that way, whereas I would hope as root that I could pull files too.

0

I'm going to attempt a self-answer although it is something of a Frame Challenge / XY problem situation.

I never found out what exactly was the problem with the configuration I had, however I was able to get what I wanted, ie fully integrated command-line ssh / rsync / bash scripting etc. by installing CyanogenMod 11 on my Samsung Galaxy S3 GT-I9300, as these and more command-line tools come as standard and are evidently properly set up so as to avoid the odd problems I experienced on my previous configuration.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.