[Top][All Lists]

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

Re: remote file editing over ssh with emacs 22.3.1 on Windows

From: Anselm Helbig
Subject: Re: remote file editing over ssh with emacs 22.3.1 on Windows
Date: Sat, 16 May 2009 20:21:39 +0200
User-agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)


> > You do it something like this:
> > 
> >   (add-to-list 'tramp-default-proxies-alist
> >         '("\\`\\'" nil "/ssh:address@hidden:"))
> > 
> > And then
> > 
> >   C-x C-f /sudo:address@hidden:/ <RET>
> 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
    User chris

  Host bar
    User www

then "ssh foo" would be equivalent to "ssh address@hidden" and
"ssh bar" would do the same thing as "ssh address@hidden". 

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!



Anselm Helbig 

reply via email to

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