unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [tramp-adb] su?
@ 2013-02-28 15:08 Neal Becker
  2013-02-28 19:44 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Becker @ 2013-02-28 15:08 UTC (permalink / raw)
  To: emacs-devel

tramp-adb is working, but I don't think it's running with root permission.  It 
is using adb shell, I believe.  After

adb shell

To get root permission, we need to use

su

I'm testing using

/adb:root@0149B2851300A016:

I got the device id using

adb devices
List of devices attached 
0149B2851300A016	device

Is there a way to get tramp-adb to have root access?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tramp-adb] su?
  2013-02-28 15:08 [tramp-adb] su? Neal Becker
@ 2013-02-28 19:44 ` Michael Albinus
  2013-03-01 11:55   ` Neal Becker
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2013-02-28 19:44 UTC (permalink / raw)
  To: Neal Becker; +Cc: Jürgen Hötzel, emacs-devel

Neal Becker <ndbecker2@gmail.com> writes:

Hi Neal,

> tramp-adb is working, but I don't think it's running with root permission.  It
> is using adb shell, I believe.  After
>
> adb shell
>
> To get root permission, we need to use
>
> su
>
> I'm testing using
>
> /adb:root@0149B2851300A016:
>
> I got the device id using
>
> adb devices
> List of devices attached
> 0149B2851300A016	device
>
> Is there a way to get tramp-adb to have root access?

That's not so simple I fear. We could add the "su" command to the
initial hand-shaking. But there is the problem, that Tramp copies files
from/to Android devices by "adb pull" and "adb push", which have the
same permissions as adbd on the device. Even if you could navigate in
the directories being root, you wouldn't be able to open files.

Furthermore, the "su" command does not exist on unrooted devices. I own
an unrooted "Nexus S" for testing, and it tells me

--8<---------------cut here---------------start------------->8---
[albinus@arthur ~]$ adb shell
shell@android:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
shell@android:/ $ su
/system/bin/sh: su: not found
--8<---------------cut here---------------end--------------->8---

Alternatively, if you have a running sshd on the device, you could use
the usual ssh-based methods for access. See the Tramp manual for setup
hints.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tramp-adb] su?
  2013-02-28 19:44 ` Michael Albinus
@ 2013-03-01 11:55   ` Neal Becker
  2013-03-01 21:23     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Becker @ 2013-03-01 11:55 UTC (permalink / raw)
  To: emacs-devel

Michael Albinus wrote:

> Neal Becker <ndbecker2@gmail.com> writes:
> 
> Hi Neal,
> 
>> tramp-adb is working, but I don't think it's running with root permission. 
>> It
>> is using adb shell, I believe.  After
>>
>> adb shell
>>
>> To get root permission, we need to use
>>
>> su
>>
>> I'm testing using
>>
>> /adb:root@0149B2851300A016:
>>
>> I got the device id using
>>
>> adb devices
>> List of devices attached
>> 0149B2851300A016	device
>>
>> Is there a way to get tramp-adb to have root access?
> 
> That's not so simple I fear. We could add the "su" command to the
> initial hand-shaking. But there is the problem, that Tramp copies files
> from/to Android devices by "adb pull" and "adb push", which have the
> same permissions as adbd on the device. Even if you could navigate in
> the directories being root, you wouldn't be able to open files.
> 
> Furthermore, the "su" command does not exist on unrooted devices. I own
> an unrooted "Nexus S" for testing, and it tells me
> 
> --8<---------------cut here---------------start------------->8---
> [albinus@arthur ~]$ adb shell
> shell@android:/ $ id
> uid=2000(shell) gid=2000(shell)
> 
groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
> shell@android:/ $ su /system/bin/sh: su: not found
> --8<---------------cut here---------------end--------------->8---
> 
> Alternatively, if you have a running sshd on the device, you could use
> the usual ssh-based methods for access. See the Tramp manual for setup
> hints.
> 
> Best regards, Michael.

I'm not familiar with the code.  But here are a couple of thoughts:

1. Always issue su and if it doesn't work, ignore the error

2. Isn't it true that adb push/pull runs with root privledge?  I haven't tested, 
but I don't recall ever seeing permission denied when doing adb push.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tramp-adb] su?
  2013-03-01 11:55   ` Neal Becker
@ 2013-03-01 21:23     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2013-03-01 21:23 UTC (permalink / raw)
  To: Neal Becker; +Cc: Jürgen Hötzel, emacs-devel

Neal Becker <ndbecker2@gmail.com> writes:

Hi Neal,

> I'm not familiar with the code.  But here are a couple of thoughts:
>
> 1. Always issue su and if it doesn't work, ignore the error

Well, I have applied a patch to tramp-adb.el which

* Performs "su <user>" if user is given in the file name
* Raises an error if this command fails.

With this, the usual "/adb::" still works, and "/adb:root@:" works if
the device supports it.

(My examples assume, that the host name is optional if there is exactly
one device connected via adb)

> 2. Isn't it true that adb push/pull runs with root privledge?  I
> haven't tested,
> but I don't recall ever seeing permission denied when doing adb push.

Don't know. Let's see what other people report. Maybe you must call
"adb root" outside Emacs in advance; but I really don't know ...

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-01 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 15:08 [tramp-adb] su? Neal Becker
2013-02-28 19:44 ` Michael Albinus
2013-03-01 11:55   ` Neal Becker
2013-03-01 21:23     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).