all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* remote file editing over ssh with emacs 22.3.1 on Windows
@ 2009-05-07  8:48 Chris Withers
  2009-05-07 18:27 ` Eli Zaretskii
  0 siblings, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-07  8:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi All,

I'm trying to get remote editing working using ssh.

I've copied in the the relevant tramp stuff from 
http://www.redantigua.com/emacs-win.html
...to my ~/_emacs files, although I'm using the tramp that came with 
emacs 22.3.1, not a separately downloaded one.

The first problem I hit was that the remote machine's key was not in the 
registry, so tramp/plink stalled with the following in its buffer:

"""
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 cc:7f:79:8a:20:04:b7:39:6c:a7:3e:4f:ea:4f:b1:e3
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
"""

How can I interact with this to say "yes"?

Anyway, I worked around that problem by connecting using plink.exe in a 
dos box and caching the key.

This gets further now, but takes an awful long time with the message:
'tramp: Setting up remote shell' showing before bombing. Here's the 
chunk from the Messages buffer:

tramp: Opening connection for cwithers@server1.simplistix.co.uk using nil...
tramp: Waiting for prompts from remote shell
tramp: Waiting 60s for prompt from remote shell
tramp: Found remote shell prompt.
tramp: Initializing remote shell
Loading time-date...done
tramp: Waiting 30s for remote `/bin/sh' to come up...
tramp: Setting up remote shell environment
apply: Couldn't `stty -inlcr -echo kill '^U'', see buffer `*tramp/plink 
cwithers@server1.simplistix.co.uk*'

The tramp/plink buffer contains:

stty -inlcr -echo kill '^U'
$ $

Can someone point me to what's gone wrong and how I can fix it?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-07  8:48 remote file editing over ssh with emacs 22.3.1 on Windows Chris Withers
@ 2009-05-07 18:27 ` Eli Zaretskii
  2009-05-07 18:48   ` Ian Eure
  0 siblings, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2009-05-07 18:27 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 07 May 2009 09:48:15 +0100
> From: Chris Withers <chris@simplistix.co.uk>
> 
> The first problem I hit was that the remote machine's key was not in the 
> registry, so tramp/plink stalled with the following in its buffer:
> 
> """
> The server's host key is not cached in the registry. You
> have no guarantee that the server is the computer you
> think it is.
> The server's rsa2 key fingerprint is:
> ssh-rsa 2048 cc:7f:79:8a:20:04:b7:39:6c:a7:3e:4f:ea:4f:b1:e3
> If you trust this host, enter "y" to add the key to
> PuTTY's cache and carry on connecting.
> If you want to carry on connecting just once, without
> adding the key to the cache, enter "n".
> If you do not trust this host, press Return to abandon the
> connection.
> Store key in cache? (y/n)
> """
> 
> How can I interact with this to say "yes"?

You can't AFAIK.

> Anyway, I worked around that problem by connecting using plink.exe in a 
> dos box and caching the key.

That's the only way I know of to do this.

> This gets further now, but takes an awful long time with the message:
> 'tramp: Setting up remote shell' showing before bombing. Here's the 
> chunk from the Messages buffer:
> 
> tramp: Opening connection for cwithers@server1.simplistix.co.uk using nil...
> tramp: Waiting for prompts from remote shell
> tramp: Waiting 60s for prompt from remote shell
> tramp: Found remote shell prompt.
> tramp: Initializing remote shell
> Loading time-date...done
> tramp: Waiting 30s for remote `/bin/sh' to come up...
> tramp: Setting up remote shell environment
> apply: Couldn't `stty -inlcr -echo kill '^U'', see buffer `*tramp/plink 
> cwithers@server1.simplistix.co.uk*'
> 
> The tramp/plink buffer contains:
> 
> stty -inlcr -echo kill '^U'
> $ $
> 
> Can someone point me to what's gone wrong and how I can fix it?

I think this is a known problem with Tramp that comes with Emacs 22.
I think you should wait for Emacs 23.1 (to be released soon), or
perhaps install one of its pretest versions if you need this urgently.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-07 18:27 ` Eli Zaretskii
@ 2009-05-07 18:48   ` Ian Eure
  2009-05-08 21:18     ` Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Ian Eure @ 2009-05-07 18:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On May 7, 2009, at 11:27 AM, Eli Zaretskii wrote:
>> From: Chris Withers <chris@simplistix.co.uk>
>>
>> (snip)
>>
>> Can someone point me to what's gone wrong and how I can fix it?
>
> I think this is a known problem with Tramp that comes with Emacs 22.
> I think you should wait for Emacs 23.1 (to be released soon), or
> perhaps install one of its pretest versions if you need this urgently.
>
Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a while;  
you might try upgrading Tramp if you don't want to install Emacs 23.

  - Ian




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-07 18:48   ` Ian Eure
@ 2009-05-08 21:18     ` Chris Withers
  2009-05-08 21:19       ` Ian Eure
  2009-05-09  7:05       ` Eli Zaretskii
  0 siblings, 2 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-08 21:18 UTC (permalink / raw)
  To: Ian Eure; +Cc: help-gnu-emacs

Ian Eure wrote:
> Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a while; you 
> might try upgrading Tramp if you don't want to install Emacs 23.

Where can I get Emacs 23?

Where can I get Tramp 2.1.x?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-08 21:18     ` Chris Withers
@ 2009-05-08 21:19       ` Ian Eure
  2009-05-08 21:23         ` Chris Withers
  2009-05-09  7:05       ` Eli Zaretskii
  1 sibling, 1 reply; 42+ messages in thread
From: Ian Eure @ 2009-05-08 21:19 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs

On May 8, 2009, at 2:18 PM, Chris Withers wrote:

> Ian Eure wrote:
>> Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a  
>> while; you might try upgrading Tramp if you don't want to install  
>> Emacs 23.
>
> Where can I get Emacs 23?
>
http://lmgtfy.com/?q=emacs+23

> Where can I get Tramp 2.1.x?
>
http://lmgtfy.com/?q=emacs+tramp

  - Ian




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-08 21:19       ` Ian Eure
@ 2009-05-08 21:23         ` Chris Withers
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-08 21:23 UTC (permalink / raw)
  To: Ian Eure; +Cc: help-gnu-emacs

Ian Eure wrote:
>> Ian Eure wrote:
>>> Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a while; 
>>> you might try upgrading Tramp if you don't want to install Emacs 23.
>>
>> Where can I get Emacs 23?
>>
> http://lmgtfy.com/?q=emacs+23
> 
>> Where can I get Tramp 2.1.x?
>>
> http://lmgtfy.com/?q=emacs+tramp

Wow, thanks, I really like being patronised for asking on a list that 
might know the canonical sources for these packages rather than hunting 
through whatever google returns...

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-08 21:18     ` Chris Withers
  2009-05-08 21:19       ` Ian Eure
@ 2009-05-09  7:05       ` Eli Zaretskii
  2009-05-09  8:49         ` Chris Withers
  1 sibling, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2009-05-09  7:05 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 08 May 2009 22:18:07 +0100
> From: Chris Withers <chris@simplistix.co.uk>
> CC: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
> 
> Ian Eure wrote:
> > Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a while; you 
> > might try upgrading Tramp if you don't want to install Emacs 23.
> 
> Where can I get Emacs 23?

  ftp://alpha.gnu.org/gnu/emacs/pretest/windows/

> Where can I get Tramp 2.1.x?

It's part of the above.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09  7:05       ` Eli Zaretskii
@ 2009-05-09  8:49         ` Chris Withers
  2009-05-09  9:27           ` Eli Zaretskii
                             ` (2 more replies)
  0 siblings, 3 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-09  8:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii wrote:
>> Date: Fri, 08 May 2009 22:18:07 +0100
>> From: Chris Withers <chris@simplistix.co.uk>
>> CC: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
>>
>> Ian Eure wrote:
>>> Emacs 22.3 uses Tramp 2.0.58, and 2.1.x is has been out for a while; you 
>>> might try upgrading Tramp if you don't want to install Emacs 23.
>> Where can I get Emacs 23?
> 
>   ftp://alpha.gnu.org/gnu/emacs/pretest/windows/

Thanks, I'm now running 23.0.93.1

>> Where can I get Tramp 2.1.x?
> 
> It's part of the above.

Does Tramp have its own mailing list anywhere?

It certainly does seem to work much better in the newer version of 
emacs, but one observation and one question:

- with (setq insert-default-directory nil) in my .emacs file, tab 
completion in the minibuffer to a tramp destination screws up quite 
frequently.

- how do I sudo to another user on the remote system? I need to do this 
to edit a lot of the files I'd want to fiddle with...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09  8:49         ` Chris Withers
@ 2009-05-09  9:27           ` Eli Zaretskii
  2009-05-09 17:41             ` Chris Withers
  2009-05-09 18:04           ` Peter Dyballa
  2009-05-10  7:28           ` Reiner Steib
  2 siblings, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2009-05-09  9:27 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 09 May 2009 09:49:39 +0100
> From: Chris Withers <chris@simplistix.co.uk>
> CC: help-gnu-emacs@gnu.org
> 
> Does Tramp have its own mailing list anywhere?

Maybe it does, but please report any problems you find in the pretest
with "M-x report-emacs-bug RET".  That way, they get filed with the
Emacs bug-tracker, and there are chances they will be fixed before
Emacs 23.1 is released.

> - how do I sudo to another user on the remote system? I need to do this 
> to edit a lot of the files I'd want to fiddle with...

There's the "sudo" method supported by Tramp.  See the node "Inline
methods" in the Tramp manual (which is part of Emacs 23).




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09  9:27           ` Eli Zaretskii
@ 2009-05-09 17:41             ` Chris Withers
  2009-05-09 19:09               ` Eli Zaretskii
  0 siblings, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-09 17:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii wrote:
> Maybe it does, but please report any problems you find in the pretest
> with "M-x report-emacs-bug RET".  That way, they get filed with the
> Emacs bug-tracker, and there are chances they will be fixed before
> Emacs 23.1 is released.

Done for the tab completion issue.

>  on the remote system? I need to do this 
>> to edit a lot of the files I'd want to fiddle with...
> 
> There's the "sudo" method supported by Tramp.  See the node "Inline
> methods" in the Tramp manual (which is part of Emacs 23).

Hmmm, my emacs fu is weak.... I found the bit in the manual but it 
didn't help me...

What do I actually type to sudo to a different user when opening a file 
on a remote system?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09  8:49         ` Chris Withers
  2009-05-09  9:27           ` Eli Zaretskii
@ 2009-05-09 18:04           ` Peter Dyballa
  2009-05-09 18:05             ` Chris Withers
       [not found]             ` <mailman.6908.1241895850.31690.help-gnu-emacs@gnu.org>
  2009-05-10  7:28           ` Reiner Steib
  2 siblings, 2 replies; 42+ messages in thread
From: Peter Dyballa @ 2009-05-09 18:04 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs

Am 09.05.2009 um 10:49 schrieb Chris Withers:

> - how do I sudo to another user on the remote system?


Once you're root on that system you don't really need to, you might  
just need to correct permissions and ownership. Should be easy in  
dired ... (it can list files sorted by time last modified)

--
Greetings

   Pete

 From error to error, one discovers the entire truth.
				- Sigmund Freud





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09 18:04           ` Peter Dyballa
@ 2009-05-09 18:05             ` Chris Withers
  2009-05-09 19:40               ` Peter Dyballa
       [not found]             ` <mailman.6908.1241895850.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-09 18:05 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

Peter Dyballa wrote:
> Once you're root on that system you don't really need to, 

Yes, it's root I want to sudo to.

None of the servers I work with allow logging in as root.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09 17:41             ` Chris Withers
@ 2009-05-09 19:09               ` Eli Zaretskii
  2009-05-10  8:37                 ` Chris Withers
       [not found]                 ` <mailman.6949.1241969740.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 42+ messages in thread
From: Eli Zaretskii @ 2009-05-09 19:09 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 09 May 2009 18:41:38 +0100
> From: Chris Withers <chris@simplistix.co.uk>
> CC: help-gnu-emacs@gnu.org
> 
> > There's the "sudo" method supported by Tramp.  See the node "Inline
> > methods" in the Tramp manual (which is part of Emacs 23).
> 
> Hmmm, my emacs fu is weak.... I found the bit in the manual but it 
> didn't help me...
> 
> What do I actually type to sudo to a different user when opening a file 
> on a remote system?

   C-x C-f /sudo:USER@MACHINE:/PATH/TO.FILE RET

Or

   (setq tramp-default-method "sudo")
   C-x C-f /USER@MACHINE:/PATH/TO.FILE RET




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09 18:05             ` Chris Withers
@ 2009-05-09 19:40               ` Peter Dyballa
  2009-05-16 17:01                 ` Chris Withers
       [not found]                 ` <mailman.7270.1242493264.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 42+ messages in thread
From: Peter Dyballa @ 2009-05-09 19:40 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs


Am 09.05.2009 um 20:05 schrieb Chris Withers:

> None of the servers I work with allow logging in as root.


When you write this, at which protocols do you think? When it's every  
protocol, then the only chance is to SSH login as some user, become  
superuser in that user's login shell, and then send GNU Emacs as  
client to your local X server over SSH.

--
Greetings

   Pete

Imbecility, n.:
	A kind of divine inspiration, or sacred fire affecting
	censorious critics of this dictionary.
			– Ambrose Bierce: _The Devil's Dictionary_





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09  8:49         ` Chris Withers
  2009-05-09  9:27           ` Eli Zaretskii
  2009-05-09 18:04           ` Peter Dyballa
@ 2009-05-10  7:28           ` Reiner Steib
  2 siblings, 0 replies; 42+ messages in thread
From: Reiner Steib @ 2009-05-10  7:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, May 09 2009, Chris Withers wrote:

> Does Tramp have its own mailing list anywhere?

http://dir.gmane.org/gmane.emacs.tramp

http://lists.gnu.org/archive/html/tramp-devel/

http://savannah.gnu.org/projects/tramp

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09 19:09               ` Eli Zaretskii
@ 2009-05-10  8:37                 ` Chris Withers
  2009-05-10 17:29                   ` Eli Zaretskii
  2009-05-10 18:23                   ` Peter Dyballa
       [not found]                 ` <mailman.6949.1241969740.31690.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-10  8:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii wrote:
>> What do I actually type to sudo to a different user when opening a file 
>> on a remote system?
> 
>    C-x C-f /sudo:USER@MACHINE:/PATH/TO.FILE RET
> 
> Or
> 
>    (setq tramp-default-method "sudo")
>    C-x C-f /USER@MACHINE:/PATH/TO.FILE RET

Hmmm, okay, I only see one username here. How do I specify the username 
to connect as and then the username to sudo to?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
       [not found]             ` <mailman.6908.1241895850.31690.help-gnu-emacs@gnu.org>
@ 2009-05-10  8:43               ` Anselm Helbig
  2009-05-10  8:50                 ` Richard Riley
                                   ` (2 more replies)
  0 siblings, 3 replies; 42+ messages in thread
From: Anselm Helbig @ 2009-05-10  8:43 UTC (permalink / raw)
  To: help-gnu-emacs

At Sat, 09 May 2009 19:05:50 +0100,
Chris Withers <chris@simplistix.co.uk> wrote:
> 
> Peter Dyballa wrote:
> > Once you're root on that system you don't really need to, 
> 
> Yes, it's root I want to sudo to.
> 
> None of the servers I work with allow logging in as root.

There's a feature in TRAMP to do just that. This used to be called
"multi-hop" but now is configured with `tramp-default-proxies-alist';
the documentation is still under (info "(tramp) Multi-hops"). Here's
what I have in my .emacs to use it:

  (setq tramp-default-method "ssh")

  (eval-after-load "tramp"
    '(when (boundp 'tramp-default-proxies-alist)
           (add-to-list 'tramp-default-proxies-alist
                  '("\\`\\(.*\\.example\\.com\\|somehost\\.example\\.org\\)\\'"
                    "\\`root\\'"
                    "/ssh:%h:"))))

I set things like port and username In my .ssh/config:

  Host *.example.com
    User foo

  Host somehost.example.org
    User bar
    Port 666

Now I can do C-x C-f /sudo:www.example.com:/ <RET> and work on the
remote host as root. 

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-10  8:43               ` Anselm Helbig
@ 2009-05-10  8:50                 ` Richard Riley
  2009-05-16 17:03                 ` Chris Withers
       [not found]                 ` <mailman.7271.1242493390.31690.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 42+ messages in thread
From: Richard Riley @ 2009-05-10  8:50 UTC (permalink / raw)
  To: help-gnu-emacs

Anselm Helbig <anselm.helbig+news2009@googlemail.com> writes:

> At Sat, 09 May 2009 19:05:50 +0100,
> Chris Withers <chris@simplistix.co.uk> wrote:
>> 
>> Peter Dyballa wrote:
>> > Once you're root on that system you don't really need to, 
>> 
>> Yes, it's root I want to sudo to.
>> 
>> None of the servers I work with allow logging in as root.
>
> There's a feature in TRAMP to do just that. This used to be called
> "multi-hop" but now is configured with `tramp-default-proxies-alist';
> the documentation is still under (info "(tramp) Multi-hops"). Here's
> what I have in my .emacs to use it:
>
>   (setq tramp-default-method "ssh")
>
>   (eval-after-load "tramp"
>     '(when (boundp 'tramp-default-proxies-alist)
>            (add-to-list 'tramp-default-proxies-alist
>                   '("\\`\\(.*\\.example\\.com\\|somehost\\.example\\.org\\)\\'"
>                     "\\`root\\'"
>                     "/ssh:%h:"))))
>
> I set things like port and username In my .ssh/config:
>
>   Host *.example.com
>     User foo
>
>   Host somehost.example.org
>     User bar
>     Port 666
>
> Now I can do C-x C-f /sudo:www.example.com:/ <RET> and work on the
> remote host as root. 
>
> HTH, 
>
> Anselm

Q: is it only emacs 23 where you don't have to mention sudo at all?

e.g I just do:

C-x C-f "/root@host:~/.bashrc"

and tramp does the rest.


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-10  8:37                 ` Chris Withers
@ 2009-05-10 17:29                   ` Eli Zaretskii
  2009-05-10 18:23                   ` Peter Dyballa
  1 sibling, 0 replies; 42+ messages in thread
From: Eli Zaretskii @ 2009-05-10 17:29 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 10 May 2009 09:37:48 +0100
> From: Chris Withers <chris@simplistix.co.uk>
> CC: help-gnu-emacs@gnu.org
> 
> Eli Zaretskii wrote:
> >> What do I actually type to sudo to a different user when opening a file 
> >> on a remote system?
> > 
> >    C-x C-f /sudo:USER@MACHINE:/PATH/TO.FILE RET
> > 
> > Or
> > 
> >    (setq tramp-default-method "sudo")
> >    C-x C-f /USER@MACHINE:/PATH/TO.FILE RET
> 
> Hmmm, okay, I only see one username here. How do I specify the username 
> to connect as and then the username to sudo to?

Not with this method.  Sorry, it seems I misunderstood what you are
after.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-10  8:37                 ` Chris Withers
  2009-05-10 17:29                   ` Eli Zaretskii
@ 2009-05-10 18:23                   ` Peter Dyballa
  2009-05-16 16:57                     ` Chris Withers
  1 sibling, 1 reply; 42+ messages in thread
From: Peter Dyballa @ 2009-05-10 18:23 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs


Am 10.05.2009 um 10:37 schrieb Chris Withers:

> Hmmm, okay, I only see one username here. How do I specify the  
> username to connect as and then the username to sudo to?


Why so complicated? You wrote before that you can't become root. So  
you need to know a few pairs of user name and password. What is  
keeping you from logging in as some user and working in this account?  
Do you think TRAMP can't make a difference between so many sessions  
or connections?

--
Greetings

   Pete

I wouldn't recommend sex, drugs or insanity for everyone, but they've  
always worked for me.
				– Hunter S. Thompson







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
       [not found]                 ` <mailman.6949.1241969740.31690.help-gnu-emacs@gnu.org>
@ 2009-05-11 21:18                   ` Anselm Helbig
  2009-05-16 16:59                     ` Chris Withers
       [not found]                     ` <mailman.7269.1242493182.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 42+ messages in thread
From: Anselm Helbig @ 2009-05-11 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

At Sun, 10 May 2009 09:37:48 +0100,
Chris Withers <chris@simplistix.co.uk> wrote:
> 
> Eli Zaretskii wrote:
> >> What do I actually type to sudo to a different user when opening a file 
> >> on a remote system?
> > 
> >    C-x C-f /sudo:USER@MACHINE:/PATH/TO.FILE RET
> > 
> > Or
> > 
> >    (setq tramp-default-method "sudo")
> >    C-x C-f /USER@MACHINE:/PATH/TO.FILE RET
> 
> Hmmm, okay, I only see one username here. How do I specify the username 
> to connect as and then the username to sudo to?

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:/ <RET>

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-10 18:23                   ` Peter Dyballa
@ 2009-05-16 16:57                     ` Chris Withers
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-16 16:57 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

Peter Dyballa wrote:
> 
> Why so complicated? You wrote before that you can't become root. 

You weren't reading carefully, I'm afraid.

As is normal on all the unix systems I've worked on, the machines on 
which I need to edit files cannot be connected to as root.

However, often, the files I need to edit can only be edited by root.

So, I'm looking for a way to log in as one user and then sudo to root to 
edit those files.

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-11 21:18                   ` Anselm Helbig
@ 2009-05-16 16:59                     ` Chris Withers
  2009-05-23 20:02                       ` Michael Albinus
       [not found]                     ` <mailman.7269.1242493182.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-16 16:59 UTC (permalink / raw)
  To: anselm.helbig+news2009; +Cc: help-gnu-emacs@gnu.org >> Emacs Help

Anselm Helbig wrote:
> 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:/ <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?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-09 19:40               ` Peter Dyballa
@ 2009-05-16 17:01                 ` Chris Withers
  2009-05-16 18:26                   ` Peter Dyballa
       [not found]                 ` <mailman.7270.1242493264.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-16 17:01 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

Peter Dyballa wrote:
> 
> When you write this, at which protocols do you think? 

SSH.

> When it's every 
> protocol, then the only chance is to SSH login as some user, become 
> superuser in that user's login shell, and then send GNU Emacs as client 
> to your local X server over SSH.

I don't know what this means. I do know that most of the servers will 
not be running X of any description.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-10  8:43               ` Anselm Helbig
  2009-05-10  8:50                 ` Richard Riley
@ 2009-05-16 17:03                 ` Chris Withers
       [not found]                 ` <mailman.7271.1242493390.31690.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-16 17:03 UTC (permalink / raw)
  To: anselm.helbig+news2009; +Cc: Emacs Help

Anselm Helbig wrote:
> There's a feature in TRAMP to do just that. This used to be called
> "multi-hop" but now is configured with `tramp-default-proxies-alist';
> the documentation is still under (info "(tramp) Multi-hops"). Here's
> what I have in my .emacs to use it:

<snip>

This all seems like a lot of work...

I was hoping for something like:

C-x C-f /sudo:myuser:root:www.example.com:/

Is anything like that available?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
       [not found]                 ` <mailman.7271.1242493390.31690.help-gnu-emacs@gnu.org>
@ 2009-05-16 17:54                   ` Anselm Helbig
  0 siblings, 0 replies; 42+ messages in thread
From: Anselm Helbig @ 2009-05-16 17:54 UTC (permalink / raw)
  To: help-gnu-emacs

At Sat, 16 May 2009 18:03:06 +0100,
Chris Withers <chris@simplistix.co.uk> wrote:
> 
> Anselm Helbig wrote:
> > There's a feature in TRAMP to do just that. This used to be called
> > "multi-hop" but now is configured with `tramp-default-proxies-alist';
> > the documentation is still under (info "(tramp) Multi-hops"). Here's
> > what I have in my .emacs to use it:
> 
> <snip>
> 
> This all seems like a lot of work...
> 
> I was hoping for something like:
> 
> C-x C-f /sudo:myuser:root:www.example.com:/
> 
> Is anything like that available?

There used to be a way to do this, in the old days this would have
been:

  /multi:ssh:myuser@example.com:sudo::/

Alas, this doesn't work anymore. You could try an older version of
tramp, but this doesn't seem like a good solution. Maybe you should
ask the developers to put the explicit multi-hop functionality back
in? I'm not aware of the reason why it was dropped, maybe the syntax
was too confusing. 

There might also be a quick way to put this functionality back in as a
patch, but I'm not familiar enough with tramp's internals to do this. 

Regards, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
       [not found]                     ` <mailman.7269.1242493182.31690.help-gnu-emacs@gnu.org>
@ 2009-05-16 18:21                       ` Anselm Helbig
  2009-05-25 15:44                         ` Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Anselm Helbig @ 2009-05-16 18:21 UTC (permalink / raw)
  To: help-gnu-emacs

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:/ <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
    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


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-16 17:01                 ` Chris Withers
@ 2009-05-16 18:26                   ` Peter Dyballa
  0 siblings, 0 replies; 42+ messages in thread
From: Peter Dyballa @ 2009-05-16 18:26 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs


Am 16.05.2009 um 19:01 schrieb Chris Withers:

>> When it's every protocol, then the only chance is to SSH login as  
>> some user, become superuser in that user's login shell, and then  
>> send GNU Emacs as client to your local X server over SSH.
>
> I don't know what this means. I do know that most of the servers  
> will not be running X of any description.

Usually a so-called server does not run the X server. The X server is  
running on your local computer. And this local computer's X server  
can serve remote clients which then can appear on any of the displays  
the local X server serves.

--
Greetings

   Pete

With Capitalism man exploits man. With communism it's the exact  
opposite.







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
       [not found]                 ` <mailman.7270.1242493264.31690.help-gnu-emacs@gnu.org>
@ 2009-05-17  1:59                   ` Tim X
  2009-05-25 15:50                     ` Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Tim X @ 2009-05-17  1:59 UTC (permalink / raw)
  To: help-gnu-emacs

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

> Peter Dyballa wrote:
>>
>> When you write this, at which protocols do you think? 
>
> SSH.
>
>> When it's every protocol, then the only chance is to SSH login as some
>> user, become superuser in that user's login shell, and then send GNU
>> Emacs as client to your local X server over SSH.
>
> I don't know what this means. I do know that most of the servers will not
> be running X of any description.
>
> cheers,
>

Let me just recap to make sure I understand the problem.

1. You use tramp to edit files remotely as a normal user
2. sometimes, you need to edit a remote file that requires root privs.
3. You cannot ssh to the remote host as root

There are two possible solutions I can think of. The first is a type of
tramp multi-hop connection method. i.e. from the manual

   Opening `/sudo:randomhost.your.domain:' would connect first
`randomhost.your.domain' via `ssh' under your account name, and perform
`sudo -u root' on that host afterwards.  It is important to know that
the given method is applied on the host which has been reached so far.
`sudo -u root', applied on your local host, wouldn't be useful here.

For this to work, you would need to have sudo configured on the remote
host. As you have root access to edit files, you shold be able to do
this.

The second method involves taking advantage of X11. The remote servers
don't need full X11 support for this to work, though some X11 libs are
required. For an X11 connection, a lot depends on how you are
connected. Its ideal for a LAN, works OK for reasonably fast WANs, such
as DSL and can work over modem dialup at 56k (though in that case, you
would want to use one of the X11 compression protocols). For this method
to work, you enable X11 forwarding in the ssh configuration (see the ssh
manual). This option is often enabled by default on Linux systems. 

When you start a remote emacs, all the display stuff is handled by your
local X session. If your network speed is adequate, its just like
running emacs locally. 

However, a question I have to ask is how often do you really need to
edit files as root? At one time, I was responsible for maintaining a key
system on servers that were scattered all over the country. The company
I worked for had a very strict policy on root access. With only a small
amount of analysis, we found that we were able to reconfigure things so
that over 90% of what I needed to do could be done without root
access. Maybe you could do something similar? Its good practice to only
run things as root when they absolutely need those privs. Unfortunately,
there is a considerable frequency of systems where either through lazy
admins or lack of skill/knowledge, programs run as root when they don't
need to because admins don't have the knowledge, time or resources to
configure things otherwise. There are actualy only a few key reasons
things need to run as root - for example, binding to ports below
1024. Even in these cases, many well written programs will rn as root to
bind to the socket and then drop back to a less privileged user for
normal operation. 

Another solution is to use a different group and have the files owned by
that group (using the sticky bit on group directory permissions can
ensure any files created in that directory are in that group). Then, you
add that group to your user account and adjust the file permissions to
allow members of that group to edit the file. You then don't need root
authority to edit these files.

HTH

Tim




-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-16 16:59                     ` Chris Withers
@ 2009-05-23 20:02                       ` Michael Albinus
  2009-05-25 15:40                         ` Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Michael Albinus @ 2009-05-23 20:02 UTC (permalink / raw)
  To: Chris Withers
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

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

[Sorry for the late reply, I was offline last weeks due to vacations]

> Anselm Helbig wrote:
>> 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:/ <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?

Could you, please, give me an example? I guess Tramp 2.1 could be
configured the way you like. The manual discusses several scenarios
already for exactly this point.

See <http://www.gnu.org/software/tramp/#Multi_002dhops> and the examples
for usage of %u and %h.

> cheers,
>
> Chris

Best regards, Michael.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-23 20:02                       ` Michael Albinus
@ 2009-05-25 15:40                         ` Chris Withers
  2009-05-26 20:50                           ` Michael Albinus
  0 siblings, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-05-25 15:40 UTC (permalink / raw)
  To: Michael Albinus
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

Michael Albinus wrote:
>> 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?
> 
> Could you, please, give me an example? I guess Tramp 2.1 could be
> configured the way you like. The manual discusses several scenarios
> already for exactly this point.
> 
> See <http://www.gnu.org/software/tramp/#Multi_002dhops> and the examples
> for usage of %u and %h.

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)

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...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-16 18:21                       ` remote file editing over ssh with emacs 22.3.1 on Windows Anselm Helbig
@ 2009-05-25 15:44                         ` Chris Withers
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-25 15:44 UTC (permalink / raw)
  To: anselm.helbig+news2009; +Cc: help-gnu-emacs

Anselm Helbig wrote:
>> 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. 

Did it used to be? If so, how? And why was it changed?

> An easier way to maintain
> the user/hostname information is to keep it all in you ssh
> configuration file, ~/.ssh/config.

...except that I'm using Putty, because I'm on Windows, and no I can't 
change that.

> 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". 

If I could use putty environment names, like I can with the svn client, 
that would rock :-)
(except that I don't have the sudo to root bit in my putty environments, 
'cos that feels like a bad idea to me, so I'm still left with that 
problem...)

> But this basically boils down to the same thing, that you have to
> maintain your user/host mapping in a configuration file. 

...which is sucky :-(

> 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:"))

What would I type in C-x C-f to use this template?

> How many user/host-combinations do you have? Let's find a practical
> solution for this!

around 20-40 username/host combinations, and it's not a limited list. If 
a customer adds a new server, or if I need to ssh to a machine for a one 
off config change, I don't want to have to go trawling through config 
files...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-17  1:59                   ` Tim X
@ 2009-05-25 15:50                     ` Chris Withers
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-25 15:50 UTC (permalink / raw)
  To: Tim X; +Cc: Emacs Help

Tim X wrote:
> 1. You use tramp to edit files remotely as a normal user

Onec Emacs 23 becomes stable, I hope to, yes.

> 2. sometimes, you need to edit a remote file that requires root privs.

often, not sometimes, but also not always.

> 3. You cannot ssh to the remote host as root

correct.

> There are two possible solutions I can think of. The first is a type of
> tramp multi-hop connection method. i.e. from the manual
> 
>    Opening `/sudo:randomhost.your.domain:' would connect first
> `randomhost.your.domain' via `ssh' under your account name, 

What is "my account name"? How do I use a different name?

> For this to work, you would need to have sudo configured on the remote
> host.

sudo is how I become root ;-) (I don't like knowing root passwords...)

> The second method involves taking advantage of X11. The remote servers
> don't need full X11 support for this to work, though some X11 libs are
> required. For an X11 connection, a lot depends on how you are
> connected. Its ideal for a LAN, works OK for reasonably fast WANs, such
> as DSL and can work over modem dialup at 56k (though in that case, you
> would want to use one of the X11 compression protocols). For this method
> to work, you enable X11 forwarding in the ssh configuration (see the ssh
> manual). This option is often enabled by default on Linux systems. 

Does this work when emacs is running on a Windows XP box?

> However, a question I have to ask is how often do you really need to
> edit files as root? 

As root? Quite often. As a user other than the user I log in with? 
Almost always.

> amount of analysis, we found that we were able to reconfigure things so
> that over 90% of what I needed to do could be done without root
> access. Maybe you could do something similar? 

I'm not in a position where I can tell my customers what to do ;-)

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows
  2009-05-25 15:40                         ` Chris Withers
@ 2009-05-26 20:50                           ` Michael Albinus
  2009-05-30 12:26                             ` remote file editing over ssh with emacs 22.3.1 on Windows/Mac Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Michael Albinus @ 2009-05-26 20:50 UTC (permalink / raw)
  To: Chris Withers
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

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.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows/Mac
  2009-05-26 20:50                           ` Michael Albinus
@ 2009-05-30 12:26                             ` Chris Withers
  2009-05-30 12:35                               ` Michael Albinus
  2009-06-08 12:06                               ` remote editing of unix files over ssh with emacs 22.3.1 from Windows Chris Withers
  0 siblings, 2 replies; 42+ messages in thread
From: Chris Withers @ 2009-05-30 12:26 UTC (permalink / raw)
  To: Michael Albinus
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

Michael Albinus wrote:
> 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.

yep, that was the missing, thank you!

> 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))

I think this second one is redundant, right?
(as I'm on Windows, sudo'ing to localhost is a bit of a no-go ;-) )

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote file editing over ssh with emacs 22.3.1 on Windows/Mac
  2009-05-30 12:26                             ` remote file editing over ssh with emacs 22.3.1 on Windows/Mac Chris Withers
@ 2009-05-30 12:35                               ` Michael Albinus
  2009-06-08 12:06                               ` remote editing of unix files over ssh with emacs 22.3.1 from Windows Chris Withers
  1 sibling, 0 replies; 42+ messages in thread
From: Michael Albinus @ 2009-05-30 12:35 UTC (permalink / raw)
  To: Chris Withers
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

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

>> 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))
>
> I think this second one is redundant, right?
> (as I'm on Windows, sudo'ing to localhost is a bit of a no-go ;-) )

Yes.

> cheers,
>
> Chris

Best regards, Michael.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-05-30 12:26                             ` remote file editing over ssh with emacs 22.3.1 on Windows/Mac Chris Withers
  2009-05-30 12:35                               ` Michael Albinus
@ 2009-06-08 12:06                               ` Chris Withers
  2009-06-08 12:39                                 ` Michael Albinus
  2009-06-08 12:51                                 ` Peter Dyballa
  1 sibling, 2 replies; 42+ messages in thread
From: Chris Withers @ 2009-06-08 12:06 UTC (permalink / raw)
  To: Michael Albinus
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

Chris Withers wrote:
>> Than you can add two rules:
>>
>>   (add-to-list 'tramp-default-proxies-alist
>>     '(nil "\\`root\\'" "/plinkx:%h:"))

Is there anything I can do to make the remote files open in unix-mode?

Things like logrotate configs and shellscripts don't work with Windows 
line endings, which seems to happen by default :-S

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-06-08 12:06                               ` remote editing of unix files over ssh with emacs 22.3.1 from Windows Chris Withers
@ 2009-06-08 12:39                                 ` Michael Albinus
  2009-06-08 12:58                                   ` Chris Withers
  2009-06-08 12:51                                 ` Peter Dyballa
  1 sibling, 1 reply; 42+ messages in thread
From: Michael Albinus @ 2009-06-08 12:39 UTC (permalink / raw)
  To: Chris Withers
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

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

> Is there anything I can do to make the remote files open in unix-mode?
>
> Things like logrotate configs and shellscripts don't work with Windows
> line endings, which seems to happen by default :-S

You can always change the text encoding. See

  (info "(elisp)Coding Systems")

I guess, setting `file-coding-system-alist' is what you are looking for.

> Chris

Best regards, Michael.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-06-08 12:06                               ` remote editing of unix files over ssh with emacs 22.3.1 from Windows Chris Withers
  2009-06-08 12:39                                 ` Michael Albinus
@ 2009-06-08 12:51                                 ` Peter Dyballa
  1 sibling, 0 replies; 42+ messages in thread
From: Peter Dyballa @ 2009-06-08 12:51 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs@gnu.org >> Emacs Help


Am 08.06.2009 um 14:06 schrieb Chris Withers:

> Is there anything I can do to make the remote files open in unix-mode?


You could set the environment variable LC_CTYPE. GNU Emacs then uses  
it to set some coding-system variables. In its absence you can use  
(manually) the function prefer-coding-system or set-default-coding- 
systems. Besides this a few alists exist for file types etc. Just  
check the documentation!

--
Greetings

   Pete

I wouldn't recommend sex, drugs or insanity for everyone, but they've  
always worked for me.
				– Hunter S. Thompson







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-06-08 12:39                                 ` Michael Albinus
@ 2009-06-08 12:58                                   ` Chris Withers
  2009-06-08 13:08                                     ` Michael Albinus
  0 siblings, 1 reply; 42+ messages in thread
From: Chris Withers @ 2009-06-08 12:58 UTC (permalink / raw)
  To: Michael Albinus
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

Michael Albinus wrote:
> You can always change the text encoding. See
> 
>   (info "(elisp)Coding Systems")
> 
> I guess, setting `file-coding-system-alist' is what you are looking for.

But how can I do this so that it applies to all remote files?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-06-08 12:58                                   ` Chris Withers
@ 2009-06-08 13:08                                     ` Michael Albinus
  2009-06-12 15:38                                       ` Chris Withers
  0 siblings, 1 reply; 42+ messages in thread
From: Michael Albinus @ 2009-06-08 13:08 UTC (permalink / raw)
  To: Chris Withers
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

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

>> I guess, setting `file-coding-system-alist' is what you are looking for.
>
> But how can I do this so that it applies to all remote files?

I would do (untested):

  (add-to-list  'file-coding-system-alist
                `(,tramp-file-name-regexp . raw-text-unix))

> Chris

Best regards, Michael.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: remote editing of unix files over ssh with emacs 22.3.1 from Windows
  2009-06-08 13:08                                     ` Michael Albinus
@ 2009-06-12 15:38                                       ` Chris Withers
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Withers @ 2009-06-12 15:38 UTC (permalink / raw)
  To: Michael Albinus
  Cc: help-gnu-emacs@gnu.org >> Emacs Help,
	anselm.helbig+news2009

Michael Albinus wrote:
>   (add-to-list  'file-coding-system-alist
>                 `(,tramp-file-name-regexp . raw-text-unix))

That seems to have done it, thanks!

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2009-06-12 15:38 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07  8:48 remote file editing over ssh with emacs 22.3.1 on Windows Chris Withers
2009-05-07 18:27 ` Eli Zaretskii
2009-05-07 18:48   ` Ian Eure
2009-05-08 21:18     ` Chris Withers
2009-05-08 21:19       ` Ian Eure
2009-05-08 21:23         ` Chris Withers
2009-05-09  7:05       ` Eli Zaretskii
2009-05-09  8:49         ` Chris Withers
2009-05-09  9:27           ` Eli Zaretskii
2009-05-09 17:41             ` Chris Withers
2009-05-09 19:09               ` Eli Zaretskii
2009-05-10  8:37                 ` Chris Withers
2009-05-10 17:29                   ` Eli Zaretskii
2009-05-10 18:23                   ` Peter Dyballa
2009-05-16 16:57                     ` Chris Withers
     [not found]                 ` <mailman.6949.1241969740.31690.help-gnu-emacs@gnu.org>
2009-05-11 21:18                   ` Anselm Helbig
2009-05-16 16:59                     ` Chris Withers
2009-05-23 20:02                       ` Michael Albinus
2009-05-25 15:40                         ` Chris Withers
2009-05-26 20:50                           ` Michael Albinus
2009-05-30 12:26                             ` remote file editing over ssh with emacs 22.3.1 on Windows/Mac Chris Withers
2009-05-30 12:35                               ` Michael Albinus
2009-06-08 12:06                               ` remote editing of unix files over ssh with emacs 22.3.1 from Windows Chris Withers
2009-06-08 12:39                                 ` Michael Albinus
2009-06-08 12:58                                   ` Chris Withers
2009-06-08 13:08                                     ` Michael Albinus
2009-06-12 15:38                                       ` Chris Withers
2009-06-08 12:51                                 ` Peter Dyballa
     [not found]                     ` <mailman.7269.1242493182.31690.help-gnu-emacs@gnu.org>
2009-05-16 18:21                       ` remote file editing over ssh with emacs 22.3.1 on Windows Anselm Helbig
2009-05-25 15:44                         ` Chris Withers
2009-05-09 18:04           ` Peter Dyballa
2009-05-09 18:05             ` Chris Withers
2009-05-09 19:40               ` Peter Dyballa
2009-05-16 17:01                 ` Chris Withers
2009-05-16 18:26                   ` Peter Dyballa
     [not found]                 ` <mailman.7270.1242493264.31690.help-gnu-emacs@gnu.org>
2009-05-17  1:59                   ` Tim X
2009-05-25 15:50                     ` Chris Withers
     [not found]             ` <mailman.6908.1241895850.31690.help-gnu-emacs@gnu.org>
2009-05-10  8:43               ` Anselm Helbig
2009-05-10  8:50                 ` Richard Riley
2009-05-16 17:03                 ` Chris Withers
     [not found]                 ` <mailman.7271.1242493390.31690.help-gnu-emacs@gnu.org>
2009-05-16 17:54                   ` Anselm Helbig
2009-05-10  7:28           ` Reiner Steib

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.