unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tramp multi-hop on localhost: su:sudo
@ 2009-05-18 10:18 Jonathan Groll
  2009-05-26 19:47 ` Michael Albinus
  2009-06-07 16:54 ` Michael Albinus
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Groll @ 2009-05-18 10:18 UTC (permalink / raw)
  To: help-gnu-emacs

On OS X  (perhaps not unwarranted) I'm too afraid to let my regular
user have sudo rights, so if I want to edit a file as root, I need to
first su to another user account (that is in the sudoers file) and
then sudo to root.

All works well except for tramp. I can su and edit files that belong
to another user, but still haven't worked out how to get multihop to
the root user working.

I've read the manual, on other hosts I can use tramp multihop to first
ssh into another host and then sudo to root (eg. ubuntu boxes), but
still haven't managed to get the > su> sudo hop working on my mac.

How do I do this? Is it possible even on the localhost?

Many thanks,
Jonathan




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

* Re: Tramp multi-hop on localhost: su:sudo
  2009-05-18 10:18 Tramp multi-hop on localhost: su:sudo Jonathan Groll
@ 2009-05-26 19:47 ` Michael Albinus
  2009-06-07 16:54 ` Michael Albinus
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2009-05-26 19:47 UTC (permalink / raw)
  To: Jonathan Groll; +Cc: help-gnu-emacs

Jonathan Groll <lists@groll.co.za> writes:

> On OS X  (perhaps not unwarranted) I'm too afraid to let my regular
> user have sudo rights, so if I want to edit a file as root, I need to
> first su to another user account (that is in the sudoers file) and
> then sudo to root.
>
> All works well except for tramp. I can su and edit files that belong
> to another user, but still haven't worked out how to get multihop to
> the root user working.
>
> I've read the manual, on other hosts I can use tramp multihop to first
> ssh into another host and then sudo to root (eg. ubuntu boxes), but
> still haven't managed to get the > su> sudo hop working on my mac.
>
> How do I do this? Is it possible even on the localhost?

Same question: is it Tramp 2.1 you are using?

> Many thanks,
> Jonathan

Best regards, Michael.




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

* Re: Tramp multi-hop on localhost: su:sudo
  2009-05-18 10:18 Tramp multi-hop on localhost: su:sudo Jonathan Groll
  2009-05-26 19:47 ` Michael Albinus
@ 2009-06-07 16:54 ` Michael Albinus
  2009-06-08 21:57   ` Jonathan Groll
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2009-06-07 16:54 UTC (permalink / raw)
  To: Jonathan Groll; +Cc: help-gnu-emacs

Jonathan Groll <lists@groll.co.za> writes:

> On OS X  (perhaps not unwarranted) I'm too afraid to let my regular
> user have sudo rights, so if I want to edit a file as root, I need to
> first su to another user account (that is in the sudoers file) and
> then sudo to root.
>
> All works well except for tramp. I can su and edit files that belong
> to another user, but still haven't worked out how to get multihop to
> the root user working.
>
> I've read the manual, on other hosts I can use tramp multihop to first
> ssh into another host and then sudo to root (eg. ubuntu boxes), but
> still haven't managed to get the > su> sudo hop working on my mac.
>
> How do I do this? Is it possible even on the localhost?

I would do (untested)

     (add-to-list 'tramp-default-proxies-alist
                  '("\\`localhost\\'" "\\`root\\'" "/su:otheruser@%h:"))

Then you can apply "C-x C-f /sudo:root@localhost:".

> Many thanks,
> Jonathan

Best regards, Michael.




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

* Re: Tramp multi-hop on localhost: su:sudo
  2009-06-07 16:54 ` Michael Albinus
@ 2009-06-08 21:57   ` Jonathan Groll
  2009-06-09  4:08     ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Groll @ 2009-06-08 21:57 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

On Sun, Jun 07, 2009 at 06:54:48PM +0200, Michael Albinus wrote:
>Jonathan Groll <lists@groll.co.za> writes:
>
>> On OS X  (perhaps not unwarranted) I'm too afraid to let my regular
>> user have sudo rights, so if I want to edit a file as root, I need to
>> first su to another user account (that is in the sudoers file) and
>> then sudo to root.
>>
>> All works well except for tramp. I can su and edit files that belong
>> to another user, but still haven't worked out how to get multihop to
>> the root user working.
>>
>> I've read the manual, on other hosts I can use tramp multihop to first
>> ssh into another host and then sudo to root (eg. ubuntu boxes), but
>> still haven't managed to get the > su> sudo hop working on my mac.
>>
>> How do I do this? Is it possible even on the localhost?
>
>I would do (untested)
>
>     (add-to-list 'tramp-default-proxies-alist
>                  '("\\`localhost\\'" "\\`root\\'" "/su:otheruser@%h:"))
>
>Then you can apply "C-x C-f /sudo:root@localhost:".

Wow! It worked! I didn't have to 'weaken' the security of my
system. Tramp is truly wonderful.

Only one odd thing - even though I'd already established a tramp
session as:
/su:otheruser@localhost:

When I opened my first buffer using "C-x C-f /sudo:root@localhost:"
(from an active buffer 'owned' by otheruser) it seemed to ask for
otheruser's password again, i.e. it first asked for a password for
/su:otheruser@localhost: and then it asked for a password for:
/sudo:root@localhost:

So in total I ended up entering the password for otheruser 3 times -
it seems like my first tramp session as 'otheruser' did not get
"reused". I presume the above is because of the proxy also getting a
tramp session?

Thank you and regards,
Jonathan.




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

* Re: Tramp multi-hop on localhost: su:sudo
  2009-06-08 21:57   ` Jonathan Groll
@ 2009-06-09  4:08     ` Michael Albinus
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2009-06-09  4:08 UTC (permalink / raw)
  To: Jonathan Groll; +Cc: help-gnu-emacs

Jonathan Groll <lists@groll.co.za> writes:

> Only one odd thing - even though I'd already established a tramp
> session as:
> /su:otheruser@localhost:
>
> When I opened my first buffer using "C-x C-f /sudo:root@localhost:"
> (from an active buffer 'owned' by otheruser) it seemed to ask for
> otheruser's password again, i.e. it first asked for a password for
> /su:otheruser@localhost: and then it asked for a password for:
> /sudo:root@localhost:
>
> So in total I ended up entering the password for otheruser 3 times -
> it seems like my first tramp session as 'otheruser' did not get
> "reused". I presume the above is because of the proxy also getting a
> tramp session?

Yes. However, Tramp can reuse passwords. What is your value of
`password-cache-expiry'? Usually, it is the number of seconds how long
passwords are cached. Setting it to `nil' disables the expiration.

See also

  (info "(tramp)Password handling")

> Thank you and regards,
> Jonathan.

Best regards, Michael.




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

end of thread, other threads:[~2009-06-09  4:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 10:18 Tramp multi-hop on localhost: su:sudo Jonathan Groll
2009-05-26 19:47 ` Michael Albinus
2009-06-07 16:54 ` Michael Albinus
2009-06-08 21:57   ` Jonathan Groll
2009-06-09  4:08     ` Michael Albinus

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).