I am running Android Revolution HD 52.0 custom ROM (Android 4.3) with Koush's superuser 220.127.116.11 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.