From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anselm Helbig Newsgroups: gmane.emacs.help Subject: Re: remote file editing over ssh with emacs 22.3.1 on Windows Date: Sat, 16 May 2009 20:21:39 +0200 Organization: Freie Universitaet Berlin Message-ID: <8763g0hpsc.wl%anselm.helbig+news2009@googlemail.com> References: <4A02A04F.6010307@simplistix.co.uk> <83hbzwdazt.fsf@gnu.org> <0F841C30-5A42-4F96-95CE-49FA51BDBDB6@digg.com> <4A04A18F.2020404@simplistix.co.uk> <833abedact.fsf@gnu.org> <4A0543A3.9000007@simplistix.co.uk> <83y6t6bp8l.fsf@gnu.org> <4A05C052.10607@simplistix.co.uk> <83bpq2ytya.fsf@gnu.org> <87fxfbibjr.wl%anselm.helbig+news2009@googlemail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1242499354 23948 80.91.229.12 (16 May 2009 18:42:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 May 2009 18:42:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 16 20:42:26 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 1M5Oq1-0007OA-9M for geh-help-gnu-emacs@m.gmane.org; Sat, 16 May 2009 20:42:25 +0200 Original-Received: from localhost ([127.0.0.1]:41359 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M5Oq0-0005H6-MP for geh-help-gnu-emacs@m.gmane.org; Sat, 16 May 2009 14:42:24 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 60 Original-X-Trace: news.uni-berlin.de EgDm5E1xwlLDTndbr2IvnA05Oypsjg6eW8d4/wCSBU+W4MvTFLMynCXS3x Cancel-Lock: sha1:c8+xbUnSEcGRr5NjFtMqoM2bNbY= In-Reply-To: Mail-Followup-To: anselm.helbig+news2009@googlemail.com User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) Original-Xref: news.stanford.edu gnu.emacs.help:169242 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:64503 Archived-At: Hi! > > You do it something like this: > > > > (add-to-list 'tramp-default-proxies-alist > > '("\\`host.example.com\\'" nil "/ssh:remoteuser@%h:")) > > > > And then > > > > C-x C-f /sudo:privilegeduser@host.example.com:/ > > Okay, I haven't tried this, but that's because it appears I need to add > code to my .emacs file for every username/hostname combination that I > want to log in to. > > Is there no way I can specify both the username to use to log in with > *and* the username to sudo to as part of the C-x C-f process? Unfortunately this is no longer possible. An easier way to maintain the user/hostname information is to keep it all in you ssh configuration file, ~/.ssh/config. This has the added benefit that you don't have to type in usernames on the command line anymore. You can also do aliases for hosts here. And for different aliases you can have different usernames, e.g. if you put this in your ~/.ssh/config Host foo HostName foo.example.com User chris Host bar HostName foo.example.com User www then "ssh foo" would be equivalent to "ssh chris@foo.example.com" and "ssh bar" would do the same thing as "ssh www@foo.example.com". But this basically boils down to the same thing, that you have to maintain your user/host mapping in a configuration file. If you always need to do sudo to login as root you can use a generic proxy template like this (add-to-list 'tramp-default-proxies-alist '("\\`.*\\'" "\\`root\\'" "/ssh:%h:")) I also could image some smart elisp code reading the ssh-config on startup, finding out which hosts have a username associated with it and only adding templates for these to tramp-default-proxies-alist. If this is really necessary depends on what you really need. How many user/host-combinations do you have? Let's find a practical solution for this! HTH, Anselm -- Anselm Helbig mailto:anselm.helbig+news2009@googlemail.com