tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: editing a file on a remote host as root


From: Michael Albinus
Subject: Re: editing a file on a remote host as root
Date: Wed, 30 Dec 2009 21:08:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Chris Withers <address@hidden> writes:

>>>> For this, you need another rule, like
>>>>
>>>> (add-to-list 'tramp-default-proxies-alist
>>>>               '(nil "\\`different_user_to_my_local_user\\'" "/ssh:%h:"))
>>> Okay, but how can I make that generic such that I don't need to add a
>>> new rule to my .emacs file every time I have to use a new username to
>>> log into a particular host?
>>
>> It can be a regular expression. If you know one which matches every user
>> but the "transit" user you need to jump first, you're done.
>
> I don't follow and also don't see how that solves the problem when the
> transit username is the same as that of the user on the remote
> machine.

The "transit username" (my slang, sorry) is *also* a user on the remote
host. Sudoing on another host is always done by two steps:

- Connect to the remote host with a username who is allowed to receive a
  remote connection, by whatever method (ssh, rsh, telnet, ...). This
  user I call "transit user".

- Inside that remote session, apply "su" or "sudo", as you like, to the
  remote user you want to work as.

So there are two different users "in use" on the remote machine. Maybe a
picture?

 +-----------+      +------------+
 |           | ---> | transit@   |--+
 | you@      | ssh  +------------+  | sudo
 |           |      | user@      |<-+
 +-----------+      +------------+
   localhost          remotehost

In fact, this is needed only when the "remote user" cannot be accessed
via the method used in the first step; otherwise you could just go this
direct way.

Or, as you said, "when the transit username is the same as that of the
user on the remote machine", you just apply ssh to that user on the
remote host, and no sudo is needed at all.

> Chris

Best regards, Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]