help-gnu-emacs
[Top][All Lists]
Advanced

[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: Michael Albinus
Subject: Re: remote file editing over ssh with emacs 22.3.1 on Windows
Date: Tue, 26 May 2009 22:50:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux)

Chris Withers <chris@simplistix.co.uk> writes:

> I think I gave the example somewhere else in this thread, but I'd be
> looking to connect to something like:
>
> /cwithers:root@somehost.somedomain:/blah
>
> Why do I need cwithers? Because my local account is "Chris Withers" on
> the windows box where emacs lives, and my username on the remote
> machine is not always the same, it depends on the box (it can be
> chris, chrisw, cwithers, etc... I don't have control over that)

OK, I've checked the whole thread. I see your problem.

Anselm gave you several hints for configuration of ssh. Unfortunately,
you do not run ssh but putty.

Tramp supports a method called "plinkx" (since Tramp 2.1.10, I
believe). This is used to take putty session names, instead of host
names.

So for every remote host you want to access, you might create a putty
session, which includes the host and user names. Let's call such a putty
session "somehost", with host name "somehost.somedomain" and user name
"cwithers". Likely, you have done this already.

Than you can add two rules:

  (add-to-list 'tramp-default-proxies-alist
    '(nil "\\`root\\'" "/plinkx:%h:"))

  (add-to-list 'tramp-default-proxies-alist
    '("\\`localhost\\'" "\\`root\\'" nil))

The first rule means, whenever you want to be root on a remote host
(identified by a putty session name), Tramp first applies "plinkx" for
that session. The second rule makes an exception for the localhost, that
means "/sudo:localhost:" is performed directly.

Now you can use "/sudo:somehost:/blah", which means that first the
"plinkx" method is applied for putty session "somehost", and afterwards
"sudo" for user "root" is applied on host "somehost.somedomain", which
is configured in that session.

If you have other use cases (for example not to use multihop on some
hosts), you must trim the regexpes of the first rule.

(Note I haven't tested it, because I don't run MS Windows)

> One other wishlist item would be for tab complete or to be able to
> build a menu of the common hosts I want to connect to, typing
> "server1.simplistix.co.uk" is tiresome...

This is builtin: Tramp remembers all used host names (or putty session
names), and offers them next time in the minibuffer for completion.

> cheers,
>
> Chris

Best regards, Michael.




reply via email to

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