Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using TRAMP on Windows

614 views
Skip to first unread message

Deniz Dogan

unread,
Mar 11, 2011, 5:00:14 AM3/11/11
to emacs-help
Hi,

I'm using:
GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2011-02-08 on 3249CTO.

I'm trying to edit some file on a server using TRAMP (SSH):

C-x C-f /theserver:.emacs

It asks me for the login name and the password, I type them in
correctly, but the password is not accepted. This all works fine when
I connect using SSH in PuTTY.

What am I doing wrong? I have not modified any TRAMP settings.

Thanks,
Deniz Dogan

Deniz Dogan

unread,
Mar 11, 2011, 5:09:23 AM3/11/11
to emacs-help
2011/3/11 Deniz Dogan <deniz.a...@gmail.com>:

It seems to be using plink by the way, which I have on my PATH.

11:07:49.497000 tramp-maybe-open-connection (3) # Opening connection
for theserver using pscp...
11:07:49.509000 tramp-maybe-open-connection (6) # C:\Windows\system32\cmd.exe
11:07:49.577000 tramp-maybe-open-connection (3) # Sending command
`plink -ssh theserver && exit || exit'
11:07:49.577000 tramp-send-command (6) # plink -ssh theserver && exit || exit

Doing "plink -ssh theserver" in cmd.exe myself and entering the login
details works just fine, I get a shell and everything.

--
Deniz Dogan

Jonathan Groll

unread,
Mar 11, 2011, 5:25:42 AM3/11/11
to help-gnu-emacs
On Fri, 11 Mar 2011 11:00:14 +0100, Deniz Dogan <deniz.a...@gmail.com> wrote:

> Hi,
>
> I'm using:
> GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2011-02-08 on 3249CTO.
>
> I'm trying to edit some file on a server using TRAMP (SSH):
>
> C-x C-f /theserver:.emacs
>
> It asks me for the login name and the password, I type them in
> correctly, but the password is not accepted. This all works fine when
> I connect using SSH in PuTTY.

Hi Deniz

I've had problems with specifying the port with plink, so if I wanted
to connect to a host on port 2222 it would need something like

/plink:jonathan@host#2222:.emacs

Cheers,
Jonathan
--
jjg: Jonathan J. Groll : groll co za
has_one { :blog => "http://bloggroll.com" }
Sent from my computer device which runs on free software

Eli Zaretskii

unread,
Mar 11, 2011, 5:28:25 AM3/11/11
to help-gn...@gnu.org
> From: Deniz Dogan <deniz.a...@gmail.com>
> Date: Fri, 11 Mar 2011 11:00:14 +0100

>
> GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2011-02-08 on 3249CTO.
>
> I'm trying to edit some file on a server using TRAMP (SSH):
>
> C-x C-f /theserver:.emacs
>
> It asks me for the login name and the password, I type them in
> correctly, but the password is not accepted. This all works fine when
> I connect using SSH in PuTTY.

Does PuTTY ask for a password as well, or do you use Pageant?

> What am I doing wrong? I have not modified any TRAMP settings.

FWIW, "C-x C-f /plink:USERNAME@SERVER:.emacs RET" works for me (with
PuTTY's plink and Pageant running).

Deniz Dogan

unread,
Mar 11, 2011, 5:35:08 AM3/11/11
to Eli Zaretskii, help-gn...@gnu.org
2011/3/11 Eli Zaretskii <el...@gnu.org>:

>> From: Deniz Dogan <deniz.a...@gmail.com>
>> Date: Fri, 11 Mar 2011 11:00:14 +0100
>>
>> GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2011-02-08 on 3249CTO.
>>
>> I'm trying to edit some file on a server using TRAMP (SSH):
>>
>> C-x C-f /theserver:.emacs
>>
>> It asks me for the login name and the password, I type them in
>> correctly, but the password is not accepted.  This all works fine when
>> I connect using SSH in PuTTY.
>
> Does PuTTY ask for a password as well, or do you use Pageant?
>

PuTTY asks for both login and password, yes.

>> What am I doing wrong?  I have not modified any TRAMP settings.
>
> FWIW, "C-x C-f /plink:USERNAME@SERVER:.emacs RET" works for me (with
> PuTTY's plink and Pageant running).
>

This works for me as well, but without Pageant. So why doesn't it work
doing it the standard way?

--
Deniz Dogan

Eli Zaretskii

unread,
Mar 11, 2011, 6:34:43 AM3/11/11
to help-gn...@gnu.org
> From: Deniz Dogan <deniz.a...@gmail.com>
> Date: Fri, 11 Mar 2011 11:35:08 +0100
> Cc: help-gn...@gnu.org

>
> > FWIW, "C-x C-f /plink:USERNAME@SERVER:.emacs RET" works for me (with
> > PuTTY's plink and Pageant running).
> >
>
> This works for me as well, but without Pageant. So why doesn't it work
> doing it the standard way?

Who said it doesn't? It does for me, if I say

C-x C-f /USERNAME@SERVER:.emacs RET

In your example, you didn't use the USERNAME@ part, perhaps that's the
reason.

Also note that by default, Tramp uses pscp, not plink (see
tramp-default-method).

Deniz Dogan

unread,
Mar 11, 2011, 6:58:54 AM3/11/11
to Eli Zaretskii, help-gn...@gnu.org
2011/3/11 Eli Zaretskii <el...@gnu.org>:

>> From: Deniz Dogan <deniz.a...@gmail.com>
>> Date: Fri, 11 Mar 2011 11:35:08 +0100
>> Cc: help-gn...@gnu.org
>>
>> > FWIW, "C-x C-f /plink:USERNAME@SERVER:.emacs RET" works for me (with
>> > PuTTY's plink and Pageant running).
>> >
>>
>> This works for me as well, but without Pageant. So why doesn't it work
>> doing it the standard way?
>
> Who said it doesn't?  It does for me, if I say
>
>   C-x C-f /USERNAME@SERVER:.emacs RET
>
> In your example, you didn't use the USERNAME@ part, perhaps that's the
> reason.
>

But TRAMP prompts me for the username when I omit it. I enter the
username and then the password but authentication fails.

--
Deniz Dogan

Eli Zaretskii

unread,
Mar 11, 2011, 7:27:06 AM3/11/11
to help-gn...@gnu.org
> From: Deniz Dogan <deniz.a...@gmail.com>
> Date: Fri, 11 Mar 2011 12:58:54 +0100
> Cc: help-gn...@gnu.org

>
> >   C-x C-f /USERNAME@SERVER:.emacs RET
> >
> > In your example, you didn't use the USERNAME@ part, perhaps that's the
> > reason.
> >
>
> But TRAMP prompts me for the username when I omit it. I enter the
> username and then the password but authentication fails.

If /USERNAME@SERVER:.emacs works for you, but /SERVER:.emacs doesn't,
I guess that's some bug in Tramp that should be reported.


Jonathan Groll

unread,
Mar 11, 2011, 7:50:58 AM3/11/11
to help-gnu-emacs
On Fri, 11 Mar 2011 12:58:54 +0100, Deniz Dogan <deniz.a...@gmail.com> wrote:

> 2011/3/11 Eli Zaretskii <el...@gnu.org>:
> >> From: Deniz Dogan <deniz.a...@gmail.com>


> >> Date: Fri, 11 Mar 2011 11:35:08 +0100
> >> Cc: help-gn...@gnu.org
> >>
> >> > FWIW, "C-x C-f /plink:USERNAME@SERVER:.emacs RET" works for me (with
> >> > PuTTY's plink and Pageant running).
> >> >
> >>
> >> This works for me as well, but without Pageant. So why doesn't it work
> >> doing it the standard way?
> >
> > Who said it doesn't?  It does for me, if I say
> >

> >   C-x C-f /USERNAME@SERVER:.emacs RET
> >
> > In your example, you didn't use the USERNAME@ part, perhaps that's the
> > reason.
> >
>
> But TRAMP prompts me for the username when I omit it. I enter the
> username and then the password but authentication fails.

It doesn't prompt me for the username. If the username is ommitted, it
makes the assumption that the username is the same as the windows
domain user.

William Stevenson

unread,
Mar 11, 2011, 7:52:39 AM3/11/11
to
Deniz Dogan <deniz.a...@gmail.com> writes:

I use TRAMP on windows, here's what I have in my .emacs

(require 'tramp)
(setq tramp-auto-save-directory "c:\\tmp")
(setq tramp-default-method "plink")
(setq tramp-default-user "username"
tramp-default-host "xx.xx.xx.xx")
(add-to-list 'file-coding-system-alist
`(,tramp-file-name-regexp . raw-text-unix))


Hope that helps.

Eli Zaretskii

unread,
Mar 11, 2011, 10:49:35 AM3/11/11
to help-gn...@gnu.org
> Date: Fri, 11 Mar 2011 14:50:58 +0200
> From: Jonathan Groll <li...@groll.co.za>

>
> > But TRAMP prompts me for the username when I omit it. I enter the
> > username and then the password but authentication fails.
>
> It doesn't prompt me for the username.

Perhaps because you defined a fixed user name to use in the PuTTY
session for that server. In that case, plink and pscp take the user
name from there.

> If the username is ommitted, it makes the assumption that the
> username is the same as the windows domain user.

Which is usually a bad assumption.

Richard Riley

unread,
Mar 11, 2011, 11:25:55 AM3/11/11
to
Eli Zaretskii <el...@gnu.org> writes:

Why?

If the user name is omitted I think it's a sane assumption and ties in with how
ssh works for example.

Eli Zaretskii

unread,
Mar 11, 2011, 11:53:35 AM3/11/11
to help-gn...@gnu.org
> From: Richard Riley <ril...@googlemail.com>
> Date: Fri, 11 Mar 2011 17:25:55 +0100

>
> >> If the username is ommitted, it makes the assumption that the
> >> username is the same as the windows domain user.
> >
> > Which is usually a bad assumption.
>
> Why?

Because a Windows user name will seldom match the name of the same
user on a Unix system.

> If the user name is omitted I think it's a sane assumption and ties in with how
> ssh works for example.

It is sane assumption on Unix. On Windows, it's just the only thing
PuTTY can do, but it will more often than not fail.

Michael Albinus

unread,
Mar 11, 2011, 12:59:18 PM3/11/11
to Deniz Dogan, emacs-help
Deniz Dogan <deniz.a...@gmail.com> writes:

> It seems to be using plink by the way, which I have on my PATH.
>
> 11:07:49.497000 tramp-maybe-open-connection (3) # Opening connection
> for theserver using pscp...
> 11:07:49.509000 tramp-maybe-open-connection (6) # C:\Windows\system32\cmd.exe
> 11:07:49.577000 tramp-maybe-open-connection (3) # Sending command
> `plink -ssh theserver && exit || exit'
> 11:07:49.577000 tramp-send-command (6) # plink -ssh theserver && exit || exit

Are there more traces in the debug buffer? And what's the contents of
the "*tramp/pscp theserver*" buffer?

> Doing "plink -ssh theserver" in cmd.exe myself and entering the login
> details works just fine, I get a shell and everything.

Best regards, Michael.

Deniz Dogan

unread,
Mar 11, 2011, 2:08:18 PM3/11/11
to Michael Albinus, emacs-help
2011/3/11 Michael Albinus <michael...@gmx.de>:

> Deniz Dogan <deniz.a...@gmail.com> writes:
>
>> It seems to be using plink by the way, which I have on my PATH.
>>
>> 11:07:49.497000 tramp-maybe-open-connection (3) # Opening connection
>> for theserver using pscp...
>> 11:07:49.509000 tramp-maybe-open-connection (6) # C:\Windows\system32\cmd.exe
>> 11:07:49.577000 tramp-maybe-open-connection (3) # Sending command
>> `plink   -ssh theserver && exit || exit'
>> 11:07:49.577000 tramp-send-command (6) # plink   -ssh theserver && exit || exit
>
> Are there more traces in the debug buffer? And what's the contents of
> the "*tramp/pscp theserver*" buffer?
>

The contents are:

plink -ssh www.theserver.com && exit || exit
login as:

There are more traces in the debug buffer, I have tramp-verbose set to
6. The most interesting find I did was this:

webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
webthe...@www.theserver.com's password:
Access denied
Access denied
Access denied
Access denied
Access denied
Access denied
FATAL ERROR: Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures for webtheserver"

Process *tramp/pscp www.theserver.com* exited abnormally with code 1

What's really weird about this is the fact that I'm logging in with
the username "webtheserver1", not "webtheserver" as shown in the log!

--
Deniz Dogan

Michael Albinus

unread,
Mar 11, 2011, 2:20:24 PM3/11/11
to Eli Zaretskii, help-gn...@gnu.org
Eli Zaretskii <el...@gnu.org> writes:

> Also note that by default, Tramp uses pscp, not plink (see
> tramp-default-method).

pscp is used for copying files. Login is still performed via plink.

Best regards, Michael.

Michael Albinus

unread,
Mar 11, 2011, 2:24:20 PM3/11/11
to Deniz Dogan, emacs-help
Deniz Dogan <deniz.a...@gmail.com> writes:

Have you been asked for the password?

If not, likely auth-source.el is in action, trying to read a password
from whatever you have specified in auth-sources.

Best regards, Michael.

Michael Albinus

unread,
Mar 11, 2011, 2:28:13 PM3/11/11
to Eli Zaretskii, help-gn...@gnu.org
Eli Zaretskii <el...@gnu.org> writes:

>> From: Deniz Dogan <deniz.a...@gmail.com>
>> Date: Fri, 11 Mar 2011 12:58:54 +0100
>> Cc: help-gn...@gnu.org
>>

>> >   C-x C-f /USERNAME@SERVER:.emacs RET
>> >
>> > In your example, you didn't use the USERNAME@ part, perhaps that's the
>> > reason.
>> >
>>

>> But TRAMP prompts me for the username when I omit it. I enter the
>> username and then the password but authentication fails.
>

> If /USERNAME@SERVER:.emacs works for you, but /SERVER:.emacs doesn't,
> I guess that's some bug in Tramp that should be reported.

Yes, looks like this. I would like to see Tramp's traces (with
tramp-verbose set to 6) in both cases, the successful and the failing
one.

Best regards, Michael.

Michael Albinus

unread,
Mar 11, 2011, 2:29:40 PM3/11/11
to Jonathan Groll, help-gnu-emacs
Jonathan Groll <li...@groll.co.za> writes:

>> But TRAMP prompts me for the username when I omit it. I enter the
>> username and then the password but authentication fails.
>

> It doesn't prompt me for the username. If the username is ommitted, it


> makes the assumption that the username is the same as the windows
> domain user.

Both cases can happen. It depends on the configuration of putty.

> Cheers,
> Jonathan

Best regards, Michael.

Michael Albinus

unread,
Mar 11, 2011, 2:36:03 PM3/11/11
to Eli Zaretskii, help-gn...@gnu.org, tramp...@gnu.org
Eli Zaretskii <el...@gnu.org> writes:

>> If the username is ommitted, it makes the assumption that the
>> username is the same as the windows domain user.
>

> Which is usually a bad assumption.

It depends.

However, it is configurable in `tramp-default-user-alist'. I'm not using
MS Windows myself; if you tell me we should drop this default for plink
and pscp, it could be done easily.

Best regards, Michael.

[Cc to tramp-devel]

Deniz Dogan

unread,
Mar 11, 2011, 2:39:52 PM3/11/11
to Michael Albinus, emacs-help
2011/3/11 Michael Albinus <michael...@gmx.de>:

Yes, I'm asked for the password and I'm entering it correctly.

--
Deniz Dogan

Michael Albinus

unread,
Mar 11, 2011, 2:40:53 PM3/11/11
to Richard Riley, help-gn...@gnu.org, tramp...@gnu.org
Richard Riley <ril...@googlemail.com> writes:

>>> If the username is ommitted, it makes the assumption that the
>>> username is the same as the windows domain user.
>>
>> Which is usually a bad assumption.
>
> Why?
>
> If the user name is omitted I think it's a sane assumption and ties in with how
> ssh works for example.

We have dropped this default for ssh some weeks ago. It is not a sane
assumption to give ssh this value as argument; it overwrites settings in
~/.ssh/config. And in case there is no argument and no config setting,
ssh assumes the local user name by default, which is sane.

I don't know which username plink is assuming if no user is given as
parameter.

Best regards, Michael.

Michael Albinus

unread,
Mar 11, 2011, 2:46:16 PM3/11/11
to Deniz Dogan, emacs-help
Deniz Dogan <deniz.a...@gmail.com> writes:

>>> FATAL ERROR: Server sent disconnect message
>>> type 2 (protocol error):
>>> "Too many authentication failures for webtheserver"
>>>
>>> Process *tramp/pscp www.theserver.com* exited abnormally with code 1
>>>
>>> What's really weird about this is the fact that I'm logging in with
>>> the username "webtheserver1", not "webtheserver" as shown in the log!
>>
>> Have you been asked for the password?
>>
>> If not, likely auth-source.el is in action, trying to read a password
>> from whatever you have specified in auth-sources.
>>
>
> Yes, I'm asked for the password and I'm entering it correctly.

As I have said the other mail, I need full traces. If you don't want to
circulate this information in the archives, send the traces off-list.

Best regards, Michael.

Eli Zaretskii

unread,
Mar 11, 2011, 2:46:48 PM3/11/11
to help-gn...@gnu.org, tramp...@gnu.org
> From: Michael Albinus <michael...@gmx.de>
> Cc: help-gn...@gnu.org, tramp...@gnu.org
> Date: Fri, 11 Mar 2011 20:36:03 +0100

>
> Eli Zaretskii <el...@gnu.org> writes:
>
> >> If the username is ommitted, it makes the assumption that the
> >> username is the same as the windows domain user.
> >
> > Which is usually a bad assumption.
>
> It depends.
>
> However, it is configurable in `tramp-default-user-alist'. I'm not using
> MS Windows myself; if you tell me we should drop this default for plink
> and pscp, it could be done easily.

I don't see a reason to drop it, as that is what plink does outside
Emacs, too.

David Kastrup

unread,
Mar 11, 2011, 2:52:08 PM3/11/11
to
Eli Zaretskii <el...@gnu.org> writes:

If plink does that by itself already, one would not need to assume it on
Emacs' side, would one?

--
David Kastrup

Eli Zaretskii

unread,
Mar 11, 2011, 3:08:47 PM3/11/11
to help-gn...@gnu.org, tramp...@gnu.org
> From: Michael Albinus <michael...@gmx.de>
> Date: Fri, 11 Mar 2011 20:40:53 +0100
> Cc: help-gn...@gnu.org, tramp...@gnu.org

>
> I don't know which username plink is assuming if no user is given as
> parameter.

As already written here, it uses the Windows username of the current
user.

Ted Zlatanov

unread,
Mar 11, 2011, 3:46:34 PM3/11/11
to
On Fri, 11 Mar 2011 20:46:16 +0100 Michael Albinus <michael...@gmx.de> wrote:

MA> Deniz Dogan <deniz.a...@gmail.com> writes:
>>>> FATAL ERROR: Server sent disconnect message
>>>> type 2 (protocol error):
>>>> "Too many authentication failures for webtheserver"
>>>>
>>>> Process *tramp/pscp www.theserver.com* exited abnormally with code 1
>>>>
>>>> What's really weird about this is the fact that I'm logging in with
>>>> the username "webtheserver1", not "webtheserver" as shown in the log!
>>>
>>> Have you been asked for the password?
>>>
>>> If not, likely auth-source.el is in action, trying to read a password
>>> from whatever you have specified in auth-sources.
>>
>> Yes, I'm asked for the password and I'm entering it correctly.

MA> As I have said the other mail, I need full traces. If you don't want to
MA> circulate this information in the archives, send the traces off-list.

Deniz, could you also set `auth-source-debug' to 'trivia so we can see
what it's doing as well? The log will go to *Messages*.

Thanks
Ted

Eli Zaretskii

unread,
Mar 11, 2011, 3:56:48 PM3/11/11
to help-gn...@gnu.org
> From: David Kastrup <d...@gnu.org>
> Date: Fri, 11 Mar 2011 20:52:08 +0100

>
> If plink does that by itself already, one would not need to assume it on
> Emacs' side, would one?

I have no idea, because I don't know what Tramp does with that
default. It could use it for something other than just passing to
plink as the username to use for logging in.

Michael Albinus

unread,
Mar 11, 2011, 4:06:22 PM3/11/11
to Eli Zaretskii, help-gn...@gnu.org
Eli Zaretskii <el...@gnu.org> writes:

>> From: David Kastrup <d...@gnu.org>
>> Date: Fri, 11 Mar 2011 20:52:08 +0100
>>
>> If plink does that by itself already, one would not need to assume it on
>> Emacs' side, would one?
>

> I have no idea, because I don't know what Tramp does with that
> default. It could use it for something other than just passing to
> plink as the username to use for logging in.

Tramp would use it for finding the password via auth-source.el. But if
somebody configures auth-sources accordingly, she could also add a rule
to tramp-default-user-alist.

The question is, whether there is additional benefit, using such a
default as Tramp builtin. If it is not common, that the Windows user
name is the same as the *nix/*nux user name, we could refrain from
setting such a default.

Best regards, Michael.

David Kastrup

unread,
Mar 11, 2011, 4:07:03 PM3/11/11
to
Eli Zaretskii <el...@gnu.org> writes:

Like deciding whether Emacs may be able to write to a file?

--
David Kastrup

Eli Zaretskii

unread,
Mar 12, 2011, 4:03:58 AM3/12/11
to help-gn...@gnu.org
> From: William Stevenson <yhvh...@gmail.com>
> Date: Fri, 11 Mar 2011 12:52:39 +0000

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

If you really need this last part (as opposed to paranoia caused by
some bad past experience), then there is a bug in Tramp that should be
reported. There's no need to disable decoding/encoding of files from
remote systems.

0 new messages