unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* tramp sudo or not sudo on remote server
@ 2011-08-27 10:37 Eric Abrahamsen
  2011-08-28 17:51 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2011-08-27 10:37 UTC (permalink / raw)
  To: help-gnu-emacs

The tramp manual explains how to access files as root on a remote
server, with a two-jump system, but there doesn't seem to be any way to
do this selectively: if I define a proxy, it seems to have me as root
for all files on that server.

Is there anyway to define two different methods for the same server, one
that operates as my normal user and one that does a second jump to work
as root?

Thanks!
Eric




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

* Re: tramp sudo or not sudo on remote server
  2011-08-27 10:37 tramp sudo or not sudo on remote server Eric Abrahamsen
@ 2011-08-28 17:51 ` Michael Albinus
  2011-08-29  2:20   ` Eric Abrahamsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2011-08-28 17:51 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

Hi,

> The tramp manual explains how to access files as root on a remote
> server, with a two-jump system, but there doesn't seem to be any way to
> do this selectively: if I define a proxy, it seems to have me as root
> for all files on that server.
>
> Is there anyway to define two different methods for the same server, one
> that operates as my normal user and one that does a second jump to work
> as root?

There is no need to apply sudo for a normal user, you could always
access via ssh like "/ssh:user@host:". This does not interfere with your
proxy settings for root.

> Thanks!
> Eric

Best regards, Michael.



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

* Re: tramp sudo or not sudo on remote server
  2011-08-28 17:51 ` Michael Albinus
@ 2011-08-29  2:20   ` Eric Abrahamsen
  2011-08-29 18:52     ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2011-08-29  2:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Aug 29 2011, Michael Albinus wrote:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> Hi,
>
>> The tramp manual explains how to access files as root on a remote
>> server, with a two-jump system, but there doesn't seem to be any way to
>> do this selectively: if I define a proxy, it seems to have me as root
>> for all files on that server.
>>
>> Is there anyway to define two different methods for the same server, one
>> that operates as my normal user and one that does a second jump to work
>> as root?
>
> There is no need to apply sudo for a normal user, you could always
> access via ssh like "/ssh:user@host:". This does not interfere with your
> proxy settings for root.

Sorry, I think I confused myself by using .ssh/config to define
Host shortcuts for servers, such that "/bl:/path" goes to a certain host as a
certain user. Presumably I wouldn't be able to use this trick if I want
to use switch between my regular user and sudo. There are a couple of
awfully long host names, though -- are there any other shortcuts I can
use?

I tried defining another Host block ("sbl") in .ssh/config, where only the
hostname and not the user were specified, but /sudo:sbl:/path just told
me that sbl was a remote host and sudo couldn't be used for remote
hosts…

Thanks again, this at least got it working!

Eric





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

* Re: tramp sudo or not sudo on remote server
  2011-08-29  2:20   ` Eric Abrahamsen
@ 2011-08-29 18:52     ` Michael Albinus
  2011-08-30  2:36       ` Eric Abrahamsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2011-08-29 18:52 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Sorry, I think I confused myself by using .ssh/config to define
> Host shortcuts for servers, such that "/bl:/path" goes to a certain host as a
> certain user.

If you don't specifiy a method, likely (the default method) scp is
used. That should work fine.

For proxy hops, you couldn't use scp, because it is an external
method. Hops must always be an internal method, like ssh.

So the following shall work:

  (add-to-list 'tramp-default-proxies-alist
               '("\\`bl\\'" "\\`root\\'" "/ssh:bl:"))

With this, it should be possible to access "/sudo:bl:/path" as root.

> Presumably I wouldn't be able to use this trick if I want
> to use switch between my regular user and sudo. There are a couple of
> awfully long host names, though -- are there any other shortcuts I can
> use?

See the Tramp manual, section "Frequently Asked Questions".

> Thanks again, this at least got it working!
>
> Eric

Best regards, Michael.



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

* Re: tramp sudo or not sudo on remote server
  2011-08-29 18:52     ` Michael Albinus
@ 2011-08-30  2:36       ` Eric Abrahamsen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2011-08-30  2:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, Aug 30 2011, Michael Albinus wrote:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Sorry, I think I confused myself by using .ssh/config to define
>> Host shortcuts for servers, such that "/bl:/path" goes to a certain host as a
>> certain user.
>
> If you don't specifiy a method, likely (the default method) scp is
> used. That should work fine.
>
> For proxy hops, you couldn't use scp, because it is an external
> method. Hops must always be an internal method, like ssh.
>
> So the following shall work:
>
>   (add-to-list 'tramp-default-proxies-alist
>                '("\\`bl\\'" "\\`root\\'" "/ssh:bl:"))
>
> With this, it should be possible to access "/sudo:bl:/path" as root.

Great! That works perfectly (and helps me make sense of what's actually
going on in these proxy sexps).

>
>> Presumably I wouldn't be able to use this trick if I want
>> to use switch between my regular user and sudo. There are a couple of
>> awfully long host names, though -- are there any other shortcuts I can
>> use?
>
> See the Tramp manual, section "Frequently Asked Questions".

Thanks, actually all I was asking was what you answered above -- how to
continue using my .ssh/config shortcuts.

>> Thanks again, this at least got it working!
>>
>> Eric
>
> Best regards, Michael.




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

end of thread, other threads:[~2011-08-30  2:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-27 10:37 tramp sudo or not sudo on remote server Eric Abrahamsen
2011-08-28 17:51 ` Michael Albinus
2011-08-29  2:20   ` Eric Abrahamsen
2011-08-29 18:52     ` Michael Albinus
2011-08-30  2:36       ` Eric Abrahamsen

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