From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jonathan Groll Newsgroups: gmane.emacs.help Subject: Re: Tramp multi-hop on localhost: su:sudo Date: Mon, 8 Jun 2009 23:57:48 +0200 Message-ID: <20090608215748.GA5278@groll.co.za> References: <20090518101805.GD26546@groll.co.za> <87ljo4q90n.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Trace: ger.gmane.org 1244498309 12957 80.91.229.12 (8 Jun 2009 21:58:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Jun 2009 21:58:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Michael Albinus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 08 23:58:25 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MDmrG-0007fA-Jb for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Jun 2009 23:58:22 +0200 Original-Received: from localhost ([127.0.0.1]:56318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDmrG-0005Ru-1j for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Jun 2009 17:58:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDmqs-0005RG-DF for help-gnu-emacs@gnu.org; Mon, 08 Jun 2009 17:57:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDmqn-0005NK-Uf for help-gnu-emacs@gnu.org; Mon, 08 Jun 2009 17:57:58 -0400 Original-Received: from [199.232.76.173] (port=55033 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDmqn-0005N7-LV for help-gnu-emacs@gnu.org; Mon, 08 Jun 2009 17:57:53 -0400 Original-Received: from mail.groll.co.za ([166.84.7.40]:40860) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MDmqk-0006JL-NZ for help-gnu-emacs@gnu.org; Mon, 08 Jun 2009 17:57:50 -0400 Original-Received: by mail.groll.co.za (Postfix, from userid 1004) id C2FA55FD7A; Mon, 8 Jun 2009 23:57:48 +0200 (SAST) Content-Disposition: inline In-Reply-To: <87ljo4q90n.fsf@gmx.de> User-Agent: Mutt/1.5.18 (Linux mail 2.6.28-xen3-U-64 x86_64) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65058 Archived-At: On Sun, Jun 07, 2009 at 06:54:48PM +0200, Michael Albinus wrote: >Jonathan Groll 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.