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

run ssh in emacs

253 views
Skip to first unread message

Haines Brown

unread,
Jan 12, 2015, 2:32:07 PM1/12/15
to
I want to gain access to two machines on the LAN by means of ssh. In
order to use emacs as a file manager, I do # ssh -Y remotehost, and then
start emacs on that host, and split its window. One buffer accesses
files on the remote machine, and I want the other buffer to access the
local machine in order to use emacs to transfer files between the
hosts. However, this does not work.

For example, if I bring up a shell in emacs (C-!) and do ! ssh localhost,
I get:

Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied (publickey,password).

Is the problem not having access to pseudo-terminal, or it that there is
no /usr/bin/ssh-askpass file? How do I construct that file. Why can't I
just provide the password when prompted for it?

Haines Brown

Tory S. Anderson

unread,
Jan 12, 2015, 2:42:32 PM1/12/15
to Haines Brown, help-gn...@gnu.org
I do something similar (I think) with my web development, but I go about it differently. I am already in emacs on my local machine and use the `M-x shell` to then ssh into the remote machine. For file management, I Tramp set up to use SSH by default, and I've had success copying back and forth remote-to-local and vice versa that way. Using dired/tramp, I can just highlight a file and hit "C" (copy) and enter the local location, or the other way around. It works pretty well for me (I've replaced putty and Filezilla with emacs), and I was doing a split-screen local/remote just yesterday with it.

- Tory

Haines Brown

unread,
Jan 13, 2015, 7:47:58 AM1/13/15
to Tory S. Anderson, help-gn...@gnu.org
On Mon, Jan 12, 2015 at 02:42:23PM -0500, Tory S. Anderson wrote:

> I do something similar (I think) with my web development, but I go
> about it differently. I am already in emacs on my local machine and
> use the `M-x shell` to then ssh into the remote machine. For file
> management, I Tramp set up to use SSH by default, and I've had
> success copying back and forth remote-to-local and vice versa that
> way. Using dired/tramp, I can just highlight a file and hit "C"
> (copy) and enter the local location, or the other way around. It
> works pretty well for me (I've replaced putty and Filezilla with
> emacs), and I was doing a split-screen local/remote just yesterday
> with it.
>
> - Tory

Thanks, Tory, that was a help. I was trying to run ssh from command
prompt rather than shell.

Can I expand on my question with one that is a bit OT? I use ~/.netrc
(despite the hazards) to automate log in to remote machines. However
things seem to have changed over the years since I last used it. I have
a stanza like this, where anon will be the name of remote machine on the
LAN

machine root@anon
login root
password <password>

When in Emacs I log into the remote machine with

C-x C-f /root@anon:/home/user

I am prompted for the password which is not automatically sent:

Password for /scpc:root@anon

This "scpc" method is new to me. I tried putting into .netrc the machine
value scpc.root@anon and scpc:root@anon, but still am prompted for the
password. The Tramp manual and man netrc no help.

Haines





Nikolay Kudryavtsev

unread,
Jan 13, 2015, 8:04:47 AM1/13/15
to help-gn...@gnu.org
Tramp methods are defined in tramp. See C-h v tramp-methods. And did you
mean scp?

To save password in tramp you can put your login and password into a
file called ~/.authinfo.gpg in this format:
machine anon login root password my-password

Authinfo is protected by gpg, so you gonna get asked for a password for
it, but just once.

Alternatively you can use authorization by key.

--
Best Regards,
Nikolay Kudryavtsev


Tory S. Anderson

unread,
Jan 13, 2015, 8:18:14 AM1/13/15
to Haines Brown, help-gn...@gnu.org
Yeah, it uses SCPC by default, and I found it pretty annoying. It was fixed by adding the following to my .emacs:

;; Tramp
(require 'tramp)
(setq tramp-default-method "ssh")

Tory S. Anderson

unread,
Jan 13, 2015, 8:19:00 AM1/13/15
to Nikolay Kudryavtsev, help-gn...@gnu.org
whoa. Where has that been all my life? I think .authinfo.gpg is going to save me much time.

Michael Albinus

unread,
Jan 13, 2015, 8:21:26 AM1/13/15
to Nikolay Kudryavtsev, help-gn...@gnu.org
Nikolay Kudryavtsev <nikolay.k...@gmail.com> writes:

> Tramp methods are defined in tramp. See C-h v tramp-methods. And did
> you mean scp?

"scpc" was a supported Tramp method up to Tramp 2.2.6. It has been
removed then.

> To save password in tramp you can put your login and password into a
> file called ~/.authinfo.gpg in this format:
> machine anon login root password my-password
>
> Authinfo is protected by gpg, so you gonna get asked for a password
> for it, but just once.
>
> Alternatively you can use authorization by key.

It might also be helpful to read the Tramp manual for this topic:

(info "(tramp)Password handling")

Best regards, Michael.

Michael Albinus

unread,
Jan 13, 2015, 8:28:32 AM1/13/15
to Tory S. Anderson, help-gn...@gnu.org, Haines Brown
torys.a...@gmail.com (Tory S. Anderson) writes:

> Yeah, it uses SCPC by default, and I found it pretty annoying. It was
> fixed by adding the following to my .emacs:
>
> ;; Tramp
> (require 'tramp)
> (setq tramp-default-method "ssh")

Well, meanwhile it is "scp". This is pretty much the same behaviour like
"ssh", except for files longer than ~10kB. And for those large files,
"scp" ought to copy faster.

Admittedly, it needs a proper password handling ...

Best regards, Michael.

Tory S. Anderson

unread,
Jan 13, 2015, 9:30:10 AM1/13/15
to Haines Brown, help-gn...@gnu.org
I forgot to mention, I also found this handy (although I might be able to forego it with the authinfo trick):

;Cache passwords for one hour
(setq password-cache-expiry 3600)

With this you don't have to enter your password every few minutes...

Haines Brown

unread,
Jan 13, 2015, 10:16:58 AM1/13/15
to Tory S. Anderson, help-gn...@gnu.org
On Tue, Jan 13, 2015 at 09:29:59AM -0500, Tory S. Anderson wrote:

> I forgot to mention, I also found this handy (although I might be able
> to forego it with the authinfo trick):
>
> ;Cache passwords for one hour
> (setq password-cache-expiry 3600)

I've made some progress, but still can't access the password in the
~/.netrc file. More specifically, in emacs I do

C-x C-f
/user@anon:

and get:

Password for /ssh:user@anon:

even though in ~/.netrc I have the stanza:

machine user@anon
login user
password <password>

It seems the ~.netrc file not being read.

Haines


Tory S. Anderson

unread,
Jan 13, 2015, 10:23:40 AM1/13/15
to Haines Brown, help-gn...@gnu.org
As I recall, Tramp (which you are using with C-x C-f) by default uses .authinfo or .authinfo.gpg, not .netrc. I've started using these and have been impressed (as of 2 hours in)

Dan Espen

unread,
Jan 13, 2015, 11:59:11 AM1/13/15
to
Haines Brown <hai...@histomat.net> writes:

> On Tue, Jan 13, 2015 at 09:29:59AM -0500, Tory S. Anderson wrote:
>
>> I forgot to mention, I also found this handy (although I might be able
>> to forego it with the authinfo trick):
>>
>> ;Cache passwords for one hour
>> (setq password-cache-expiry 3600)
>
> I've made some progress, but still can't access the password in the
> ~/.netrc file. More specifically, in emacs I do
>
> C-x C-f
> /user@anon:
>
> and get:
>
> Password for /ssh:user@anon:
>
> even though in ~/.netrc I have the stanza:
>
> machine user@anon

machine anon

--
Dan Espen

Haines Brown

unread,
Jan 13, 2015, 1:11:29 PM1/13/15
to Tory S. Anderson, help-gn...@gnu.org
On Tue, Jan 13, 2015 at 10:23:14AM -0500, Tory S. Anderson wrote:

> As I recall, Tramp (which you are using with C-x C-f) by default uses
> .authinfo or .authinfo.gpg, not .netrc. I've started using these and
> have been impressed (as of 2 hours in)

That was my problem. Years ago I used ftp to transfer files, and so
used ~/.netrc. I followed your suggestion and instead use ~/.authinfo,
and how I have no problem accessing hosts on my LAN.

When I try to access web servers via ssh, however, it does not work.
For example, in .authinfo I have this:

machine uss-irex.info:/www
login <user>
password <password>

So I do C-x C-f /uss-irex.info:/www and I'm prompted for the password.
The password not accepted. If I do C-x C-f /us...@uss-irex.info:
apparently the user is recognied because when I enter the password at
prompt, but I'm told I lack permission.

Haines

Bob Proulx

unread,
Jan 13, 2015, 11:26:29 PM1/13/15
to Haines Brown, help-gn...@gnu.org
Haines Brown wrote:
> That was my problem. Years ago I used ftp to transfer files, and so
> used ~/.netrc. I followed your suggestion and instead use ~/.authinfo,
> and how I have no problem accessing hosts on my LAN.

I recommend using ssh rsa keys. Works great generically with ssh and
isn't tramp specific. The tramp manual also recommends using the
native transport mechanisms.

> When I try to access web servers via ssh, however, it does not work.
> For example, in .authinfo I have this:
>
> machine uss-irex.info:/www
> login <user>
> password <password>

That "uss-irex.info:/www" looks like a syntax error to me. Remove the
":/www" from it and try it again.

Bob

Haines Brown

unread,
Jan 14, 2015, 7:14:11 AM1/14/15
to
Nikolay Kudryavtsev <nikolay.k...@gmail.com> writes:

> Tramp methods are defined in tramp. See C-h v tramp-methods. And did
> you mean scp?
>
> To save password in tramp you can put your login and password into a
> file called ~/.authinfo.gpg in this format: machine anon login root
> password my-password

Nikolay, your advice much appreciated, and I did make progress. I set
the method to ssh in tramp initiation file. I now use ~/.authinfo and
can readily log in to the remote LAN machine. However, this automated
transmission of the password works only for users, not if the user is
"root".

For example, if in ~/.authinfo I have the stanza:

machine target
login root
password Geheim

When in emacs I do C-x C-f /root@target: or /target:, I'm prompted for
the password. The password was transmitted for user accounts but not for
the root account.

I need to ssh as root because my aim is to use emacs dired to copy files
belonging to root between the target and the local machines. I can su to
root and then start emacs, but this session for some reason does not use
the tramp init file.

The manual says I can use (set auth-source-debug `t). I put this line in my
tramp init file, but where is its output?

I here toss in an observation that is irrevant. If the method is news, I
find that the stanza in .authinfo must be inline, such as:

machine news.giganews.com login Benutzer password Geheim

If I arrange this in a column as in the "target" example above, it
does not work.

Haines

Bob Proulx

unread,
Jan 14, 2015, 2:55:54 PM1/14/15
to help-gn...@gnu.org
Haines Brown wrote:
> For example, if in ~/.authinfo I have the stanza:

I am curious. Is there a reason you are avoiding using rsa ssh keys?
If you were using ssh rsa keys then everything you want would be
working natively. And even better it would work for everything that
uses ssh too such as rsync and other processes that use ssh.

Bob

Haines Brown

unread,
Jan 15, 2015, 11:26:55 AM1/15/15
to
I've taken almost six hours from pressing work to get tramp to access
web servers, and have gotten nowhere.

The tramp manual says that default authorization file is
~/.authinfo.gpg. I assume I can use ~/.authinfo until I get things
working.

When I use tramp in emcas (C-x C-f), I get a quick alert: .netrc is
either not owned by you or badly protected. The latter is the case. I
have an old .netrc file with commented lines in it.

I have impression the default tramp method is ftp, but if my C-x C-f
command does not specify the method, the ssh method is instead used
because in the tramp init file I specifid ftp as tramp's default
method. I must access web servers with FTP, but I make ssh the defalt
method because that's what I use to access hosts on my LAN. So when I
access web servers I need to specify the ftp protocol.

Man authinfo and info tramp do not tell me how to specify the method in
the C-x C-f command, but I find by trial and error that I can manually
log successfully with:

C-x C-f /ftp:us...@server.com:

However, to log in automatically, I must define method and user in the
.authinfo file. I can specify user and pw for my LAN hosts, but
apparently it does not work for web servers. Thus the need to specify
method and user in the command line.

The tramp manual says my .authinfo line should look like this:

machine server.com login Benutzer password Geheim

But this does not work, for the password is nevertheless requested.

If I insist by repeating the login, I can get this:

ftp> user "Benutzer"
331 Password required for user Benutzer
530 Login incorrect
ftp>

I rechecked with the web server, and its protocol is FTP, and my account
name and PW are correct. That I'm unable to log in automatically
therefore suggests a synax error that prevents the info in .authinfo
from being used.

Haines

Ted Zlatanov

unread,
Jan 15, 2015, 12:19:10 PM1/15/15
to
On Thu, 15 Jan 2015 11:26:53 -0500 Haines Brown <hai...@histomat.net> wrote:

HB> The tramp manual says that default authorization file is
HB> ~/.authinfo.gpg. I assume I can use ~/.authinfo until I get things
HB> working.

What does `auth-sources' contain?

Turn `auth-source-debug' to 'trivia to see useful debug logs in
*Messages*. That will help you figure out what's going wrong, and what
specifically is needed in the .authinfo file.

Ted

Haines Brown

unread,
Jan 15, 2015, 3:26:56 PM1/15/15
to
Ted Zlatanov <t...@lifelogs.com> writes:

> What does `auth-sources' contain?
>
> Turn `auth-source-debug' to 'trivia to see useful debug logs in
> *Messages*. That will help you figure out what's going wrong, and what
> specifically is needed in the .authinfo file.

Thanks, Ted, but I've made no progress. Auth-sources is new to me. I've
managed for years without being aware of it. I suppose that's because
its defaults suited my needs. Now I'm variouly told it is both a library
and a variable, which leaves me uncomfortable.

I should start by describing my setup. I have several emacs init files
depending on what I intend to do with an emacs session. In .fluxbox
there is a key binding that starts an executable script named
~/scripts/emacs-util. This file runs emacs with a specific init file
that I named ~.emacsUtility. This init file has a variety of things in
it, but includes these lines:

(add-to-list 'load-path "/home/haines/.emacs.d/elisp/")
(load-library "tramp")

This ~/.emacs.d/elisp/tramp is an init file that has only these lines:

(set auth-source-debug `trivia)
(setq tramp-default-method "ssh")
(require 'auth-source)
(customize-variable 'auth-sources)

The second line is because I use SSH most often with LAN hosts. The
third and fourth lines probably unecessary.

This nesting of init files worries me, but I didn't have a problem until
recently.

I now do C-x C-f /HostName.com:

ssh: Could not resolve hostname HostName.com. Name or server not known
Tramp: Waiting for prompts...

In *Messages* buffer:

Loading tramp... done
Tramp: Opening Connection for HostName.com using ssh
Tramp: Sending command `exec ssh -e None HostName.com

Beucase the web server wants the ftp protocol, my .authinfo file has the
line:

machine HostName.com port ftp login Benutzer password Geheim

apparently this value for port is not seen. It seems the authinfo file
not being accessed at all, although it is accessed when I SSH to LAN
hosts.

Haines

Ted Zlatanov

unread,
Jan 15, 2015, 4:10:23 PM1/15/15
to
On Thu, 15 Jan 2015 15:26:54 -0500 Haines Brown <hai...@histomat.net> wrote:

HB> Ted Zlatanov <t...@lifelogs.com> writes:
>> What does `auth-sources' contain?
>>
>> Turn `auth-source-debug' to 'trivia to see useful debug logs in
>> *Messages*. That will help you figure out what's going wrong, and what
>> specifically is needed in the .authinfo file.

HB> Thanks, Ted, but I've made no progress. Auth-sources is new to me. I've
HB> managed for years without being aware of it. I suppose that's because
HB> its defaults suited my needs. Now I'm variouly told it is both a library
HB> and a variable, which leaves me uncomfortable.

`auth-sources' is a variable (the `quoted' format is standard in the
Emacs community). So is `auth-source-debug'. auth-source.el is a library.

You may want to consult (info "auth") to learn more about the library.

HB> This ~/.emacs.d/elisp/tramp is an init file that has only these lines:

HB> (set auth-source-debug `trivia)
HB> (setq tramp-default-method "ssh")
HB> (require 'auth-source)
HB> (customize-variable 'auth-sources)

HB> The second line is because I use SSH most often with LAN hosts. The
HB> third and fourth lines probably unecessary.

Yes, the third is superfluous and the fourth is probably wrong.

More importantly, (set auth-source-debug `trivia) is just wrong. You
mean to use `setq' there, but you should just customize the variable:

`M-x customize-variable RET auth-source-debug'

Save the customization. Done. Learn this method and use it for all
variables you want to change. The interface is very helpful.

Do the same for `tramp-default-method' to set it to "ssh" as you desire.
There's no reason to run these only when you use Tramp.

HB> I now do C-x C-f /HostName.com:

HB> ssh: Could not resolve hostname HostName.com. Name or server not known
HB> Tramp: Waiting for prompts...

HB> In *Messages* buffer:

HB> Loading tramp... done
HB> Tramp: Opening Connection for HostName.com using ssh
HB> Tramp: Sending command `exec ssh -e None HostName.com

Erm, you're using SSH in your example but we started with FTP...

With SSH, this will have nothing to do with auth-source. SSH has its own
authentication system, typically managed through ssh-agent and so on.

HB> Beucase the web server wants the ftp protocol, my .authinfo file has the
HB> line:

HB> machine HostName.com port ftp login Benutzer password Geheim

HB> apparently this value for port is not seen. It seems the authinfo file
HB> not being accessed at all, although it is accessed when I SSH to LAN
HB> hosts.

Set `auth-source-debug' to 'trivia as requested, then open
`/ftp:user...@hostname.com' and see what shows up in the *Messages*
buffer (to see it, type `C-x b *Messages*').

Ted

Haines Brown

unread,
Jan 16, 2015, 12:18:44 PM1/16/15
to
Ted Zlatanov <t...@lifelogs.com> writes:

> More importantly, (set auth-source-debug `trivia) is just wrong. You
> mean to use `setq' there, but you should just customize the variable:
>
> `M-x customize-variable RET auth-source-debug'
>
> Save the customization. Done. Learn this method and use it for all
> variables you want to change. The interface is very helpful.
>
> Do the same for `tramp-default-method' to set it to "ssh" as you desire.
> There's no reason to run these only when you use Tramp.

To keep things simple, I customized the auth-source variable to debug
and also the tramp-default-method to ftp. Even though I will want to
make ssh default, my concern at this point is to get access to web
server. I saved the customization.

> HB> I now do C-x C-f /HostName.com:

> Erm, you're using SSH in your example but we started with FTP...
>
> With SSH, this will have nothing to do with auth-source. SSH has its own
> authentication system, typically managed through ssh-agent and so on.

With SSH to local hosts, I am presently successfully using
.authinfo. The reason for ssh showing up in the output is that I was
uncertain how to set the method for tramp to use, and to took most
conservative choice for the trial run.

In my ~/authinfo I have the line:

machine Host.com port ftp login Benutzer password Geheim

> Set `auth-source-debug' to 'trivia as requested, then open
> `/ftp:user...@hostname.com' and see what shows up in the *Messages*
> buffer (to see it, type `C-x b *Messages*').

Here is the answer to my question, which the info or man documents did
not answer. This defines the FTP method for the tramp sesson, and I
assume this overrides any tramp default method I may have set.

Running the address returns the request for password, and so .authinfo
apparently not used. The only thing in the *Messages* buffer is the
report that I've created customization setup. Only when I do RET in lieu
of providing a password, do I get a message.

1. Custom settings cannot be saved. Maybe you started Emacs with
-q.

This indeed is what I'm doing. However, in my tramp init file
I have the line (setq auth-source-debug `trivia).

2. Tramp Default Method: ftp. State: EDITED, shown value does not take
effect until you set or save it.

Nothing here about the tramp session.

I put (setq tramp-default-method "ftp") into my tramp init file and run
again. After the third RET in liew of password, I get a dump:

(ftp-error #("FTP Error: USER request failed: 530 Login incorrect."
32 52 (fontified nil front-sticky (field
inhibit-line-move-field-capture) rear-nonsticky t field output
inhibit-line-move-field-capture t))) signal(ftp-error (#("FTP Error:
USER request failed: 530 Login incorrect." 32 52 (fontified nil
front-sticky (field inhibit-line-move-field-capture) rear-nonsticky t
field output inhibit-line-move-field-capture t))))
byte-code("\301 @ A\"\207" [err signal] 3)
ange-ftp-hook-function(expand-file-name "/ftp:uss...@uss-irex.info:"
"~/") apply(ange-ftp-hook-function expand-file-name
("/ftp:uss...@uss-irex.info:" "~/"))
tramp-ftp-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" "~/") apply(tramp-ftp-file-name-handler
expand-file-name ("/ftp:uss...@uss-irex.info:" "~/"))
byte-code("\300\301\215\207" [suppress (apply foreign operation args)]
2) #[nil " K\306\211 <now comes a bunch of hex> *\207" [foreign
result sf file-name-handler-alist d default-directory nil autoload
boundp temporary-file-directory eval standard-value fboundp
temp-directory subrp functionp getenv "TEMP" file-directory-p
file-name-as-directory "TMP" "TMPDIR" file-exists-p "c:/temp" message
"Neither `temporary-file-directory' nor `temp-directory' is defined --
using /tmp." "/tmp" load noerror nomessage non-essential (byte-code
"\300\301\215\207" [suppress (apply foreign operation args)] 2) 5
"Non-essential received in operation %s" append (byte-code " < a
bunch of hex >\"\fP$*\207" [level tramp-verbose
save-match-data-internal tramp-message-show-message fmt-string args
match-data ((byte-code "\301 \302\"\207" [save-match-data-internal
set-match-data evaporate] 3)) 3 apply message 0 "" 1 2 "Warning: "
"Tramp: " 4 processp buffer-name process-buffer
tramp-dissect-file-name vectorp tramp-debug-message format "(%d) # "
vec-or-proc default-directory] 6) ((error)) tramp-run-real-handler
suppress 1 "Suppress received in operation %s" tramp-cleanup x v
operation args fmt-string level vec-or-proc
tramp-message-show-message] 7]()
tramp-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" "~/")
expand-file-name("/ftp:uss...@uss-irex.info:" "~/")
apply(expand-file-name ("/ftp:uss...@uss-irex.info:" "~/"))
tramp-completion-run-real-handler(expand-file-name
("/ftp:uss...@uss-irex.info:" "~/"))
tramp-completion-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" "~/")
file-directory-p("/ftp:uss...@uss-irex.info:")
apply(file-directory-p "/ftp:uss...@uss-irex.info:")
tramp-completion-run-real-handler(file-directory-p
("/ftp:uss...@uss-irex.info:"))
tramp-completion-file-name-handler(file-directory-p
"/ftp:uss...@uss-irex.info:")
file-directory-p("/ftp:uss...@uss-irex.info:")
find-file-noselect("/ftp:uss...@uss-irex.info:" nil nil t)
find-file("/ftp:uss...@uss-irex.info:" t)
call-interactively(find-file nil nil)
read-string("Password for uss...@uss-irex.info: " nil t nil)
read-passwd("Password for uss...@uss-irex.info: ")
ange-ftp-get-passwd("uss-irex.info" "ussir03")
ange-ftp-get-process("uss-irex.info" "ussir03")
ange-ftp-host-type("uss-irex.info" "ussir03")
ange-ftp-expand-dir("uss-irex.info" "ussir03" "~")
ange-ftp-canonize-filename("/ftp:uss...@uss-irex.info:")
ange-ftp-expand-file-name("/ftp:uss...@uss-irex.info:" nil)
apply(ange-ftp-expand-file-name ("/ftp:uss...@uss-irex.info:" nil))
byte-code("\304\305 \306\216\307\n \"+\207" [debug-on-error
save-match-data-internal fn args t match-data ((byte-code
"\301 \302\"\207" [save-match-data-internal set-match-data evaporate]
3)) apply] 3) ange-ftp-hook-function(expand-file-name
"/ftp:uss...@uss-irex.info:" nil) apply(ange-ftp-hook-function
expand-file-name ("/ftp:uss...@uss-irex.info:" nil))
tramp-ftp-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" nil) apply(tramp-ftp-file-name-handler
expand-file-name ("/ftp:uss...@uss-irex.info:" nil))
byte-code("\300\301\215\207" [suppress (apply foreign operation args)]
2) #[nil " K\306...\202 *\207" [foreign result sf
file-name-handler-alist d default-directory nil autoload boundp
temporary-file-directory eval standard-value fboundp temp-directory
subrp functionp getenv "TEMP" file-directory-p file-name-as-directory
"TMP" "TMPDIR" file-exists-p "c:/temp" message "Neither
`temporary-file-directory' nor `temp-directory' is defined -- using
/tmp." "/tmp" load noerror nomessage non-essential (byte-code
"\300\... $*\207" [level tramp-verbose save-match-data-internal
tramp-message-show-message fmt-string args match-data ((byte-code
"\301 \302\"\207" [save-match-data-internal set-match-data evaporate]
3)) 3 apply message 0 "" 1 2 "Warning: " "Tramp: " 4 processp
buffer-name process-buffer tramp-dissect-file-name vectorp
tramp-debug-message format "(%d) # " vec-or-proc default-directory] 6)
((error)) tramp-run-real-handler suppress 1 "Suppress received in
operation %s" tramp-cleanup x v operation args fmt-string level
vec-or-proc tramp-message-show-message] 7]() funcall(#[nil
" K\306...\202 ... *\207" [foreign result sf
file-name-handler-alist d default-directory nil autoload boundp
temporary-file-directory eval standard-value fboundp temp-directory
subrp functionp getenv "TEMP" file-directory-p file-name-as-directory
"TMP" "TMPDIR" file-exists-p "c:/temp" message "Neither
`temporary-file-directory' nor `temp-directory' is defined -- using
/tmp." "/tmp" load noerror nomessage non-essential (byte-code
"\300\301\215\207" [suppress (apply foreign operation args)] 2) 5
"Non-essential received in operation %s" append (byte-code "
X\205}... *\207" [level tramp-verbose save-match-data-internal
tramp-message-show-message fmt-string args match-data ((byte-code
"\301 \302\"\207" [save-match-data-internal set-match-data evaporate]
3)) 3 apply message 0 "" 1 2 "Warning: " "Tramp: " 4 processp
buffer-name process-buffer tramp-dissect-file-name vectorp
tramp-debug-message format "(%d) # " vec-or-proc default-directory] 6)
((error)) tramp-run-real-handler suppress 1 "Suppress received in
operation %s" tramp-cleanup x v operation args fmt-string level
vec-or-proc tramp-message-show-message] 7])
tramp-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" nil)
expand-file-name("/ftp:uss...@uss-irex.info:" nil)
apply(expand-file-name ("/ftp:uss...@uss-irex.info:" nil))
tramp-completion-run-real-handler(expand-file-name
("/ftp:uss...@uss-irex.info:" nil))
tramp-completion-file-name-handler(expand-file-name
"/ftp:uss...@uss-irex.info:" nil)
expand-file-name("/ftp:uss...@uss-irex.info:")
find-file-noselect("/ftp:uss...@uss-irex.info:" nil nil t)
find-file("/ftp:uss...@uss-irex.info:" t)
call-interactively(find-file nil nil)

Well, this is a lot. The only thing that strikes me is:

find-file("/ftp:uss...@uss-irex.info:" t)
call-interactively(find-file nil nil)
read-string("Password for uss...@uss-irex.info: " nil t nil)
read-passwd("Password for uss...@uss-irex.info: ")

It seems it finds .authinfo file but can't read it.

$ ls -la | grep authinfo
-rw-r--r-- 1 haines haines 1169 Jan 16 11:55 .authinfo

The password has a couple "#" characters in it, so I put it into
quotation marks, but it didn't help.

Haines

Michael Albinus

unread,
Jan 16, 2015, 3:00:00 PM1/16/15
to Haines Brown, help-gn...@gnu.org
Haines Brown <hai...@histomat.net> writes:

> Running the address returns the request for password, and so .authinfo
> apparently not used. The only thing in the *Messages* buffer is the
> report that I've created customization setup. Only when I do RET in lieu
> of providing a password, do I get a message.

The ftp method is not handled by Tramp; Tramp redirects all work to
ange-ftp.el. And that package does not use auth-ources, it simply relies
on ~/.netrc.

> Haines

Best regards, Michael.

Haines Brown

unread,
Jan 16, 2015, 3:55:43 PM1/16/15
to
Michael Albinus <michael...@gmx.de> writes:

> The ftp method is not handled by Tramp; Tramp redirects all work to
> ange-ftp.el. And that package does not use auth-ources, it simply relies
> on ~/.netrc.

Michael, sorry to be so slow on the uptake. For my Emacs 24, ELPA tells
me that ange-ftp is built in, and so I would not expect to see any
ange-ftp.el file. I gather that if I use a tramp command to transfer a
file by ftp, it is authomatically done with ange-ftp.

I presume that since I want to use ftp, I need to define the login in
the .netrc. I have this line there:

machine uss-irex.info login ussir03 password "Geheim"

I open an emacs session amd issue this command:

C-x C-f /ftp:iss...@uss-irex.info:

The messages buffer tells me:

Waiting for prompts from remote shell
ssh: connect to host ftp port 22: No route to host.

Can on infer from this that ange-ftp is attempting to log in to the
remote FTP server? But I thought port 22 was SSH? Does "No route" mean
that there is either no such server or account? Is it possible the
hosting service introduced some kind of sercurity measure of which I am
unaware (if there's nothing wrong with what I'm doing at this end, I'll
have to pursue this with them)?

In *messages* buffer:

Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec ssh -e none ftp'
Tramp: Opening connection for ftp using ssh...done
Tramp: Opening connection for ftp using ssh...
Tramp: Sending command `exec ssh -e none ftp'

Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec ssh -e none ftp'
Tramp: Opening connection for ftp using ssh...done
byte-code: Process died

I don't know how to interpret this. It seems ange-ftp wants to execute
ssh session but fails.

Haines

Dan Espen

unread,
Jan 16, 2015, 4:34:18 PM1/16/15
to
Haines Brown <hai...@histomat.net> writes:

> Michael Albinus <michael...@gmx.de> writes:
>
>> The ftp method is not handled by Tramp; Tramp redirects all work to
>> ange-ftp.el. And that package does not use auth-ources, it simply relies
>> on ~/.netrc.
>
> Michael, sorry to be so slow on the uptake. For my Emacs 24, ELPA tells
> me that ange-ftp is built in, and so I would not expect to see any
> ange-ftp.el file. I gather that if I use a tramp command to transfer a
> file by ftp, it is authomatically done with ange-ftp.
>
> I presume that since I want to use ftp, I need to define the login in
> the .netrc. I have this line there:
>
> machine uss-irex.info login ussir03 password "Geheim"

Unless your password begins and ends with quotes, this is wrong.
Get rid of the quotes.

--
Dan Espen

Michael Albinus

unread,
Jan 16, 2015, 4:36:56 PM1/16/15
to Haines Brown, help-gn...@gnu.org
Haines Brown <hai...@histomat.net> writes:

> Michael, sorry to be so slow on the uptake. For my Emacs 24, ELPA tells
> me that ange-ftp is built in, and so I would not expect to see any
> ange-ftp.el file. I gather that if I use a tramp command to transfer a
> file by ftp, it is authomatically done with ange-ftp.

Yes.

> I presume that since I want to use ftp, I need to define the login in
> the .netrc. I have this line there:
>
> machine uss-irex.info login ussir03 password "Geheim"
>
> I open an emacs session amd issue this command:
>
> C-x C-f /ftp:iss...@uss-irex.info:

I guess it is just a typo. In .netrc you write "ussir03", in the Emacs
file name you write "issir03".
>
> The messages buffer tells me:
>
> Waiting for prompts from remote shell
> ssh: connect to host ftp port 22: No route to host.

That shouldn't happen! Could you, please, start a new Emacs stanza with
"emacs -Q" and try then immediately

C-x C-f /ftp:iss...@uss-irex.info:

> Haines

Best regards, Michael.

Haines Brown

unread,
Jan 17, 2015, 7:18:20 AM1/17/15
to Michael Albinus, help-gn...@gnu.org
On Fri, Jan 16, 2015 at 10:36:42PM +0100, Michael Albinus wrote:
> Haines Brown <hai...@histomat.net> writes:
> > The messages buffer tells me:
> >
> > Waiting for prompts from remote shell
> > ssh: connect to host ftp port 22: No route to host.
>
> That shouldn't happen! Could you, please, start a new Emacs stanza with
> "emacs -Q" and try then immediately
>
> C-x C-f /ftp:iss...@uss-irex.info:

That "issir03" was just a typo, for I made up a bogus account name and
password as I went along.

I now start a $ emacs -Q session and:

C-x C-f /ftp:Benu...@uss-irex.info:

There is a brief flashed message:

~/.netrc either not owned by you or badly protected.

I suppose this is normal because ~/.netrc is by nature not protected
at all. I check /etc/group and see I'm a member of the ssh group, but
not the daemon or ssl-cert groups.

Then comes a password prompt I suppose because the password from .netrc
was not sent to the web server:

Password for Benu...@uss-irex.info:

There is nothing in *Messages" buffer.

I remake the stanza in ~/.netrc in both column and in line format by
pasting the account name and password directly from the webserver
interface. Here is its format:

machine uss-irex.info
login Benutzer
password Geheim

If at the Password prompt I copy/paste the password from this stanza,
login is successful.

I try all the above on another machine and had same results.

With a $ emacs -Q session I try:

M-x customize-variable RET
Customize variable: auth-source-debug [No match]

Haines




Dan Espen

unread,
Jan 17, 2015, 9:13:49 AM1/17/15
to
Haines Brown <hai...@histomat.net> writes:

> On Fri, Jan 16, 2015 at 10:36:42PM +0100, Michael Albinus wrote:
>> Haines Brown <hai...@histomat.net> writes:
>> > The messages buffer tells me:
>> >
>> > Waiting for prompts from remote shell
>> > ssh: connect to host ftp port 22: No route to host.
>>
>> That shouldn't happen! Could you, please, start a new Emacs stanza with
>> "emacs -Q" and try then immediately
>>
>> C-x C-f /ftp:iss...@uss-irex.info:
>
> That "issir03" was just a typo, for I made up a bogus account name and
> password as I went along.
>
> I now start a $ emacs -Q session and:
>
> C-x C-f /ftp:Benu...@uss-irex.info:
>
> There is a brief flashed message:
>
> ~/.netrc either not owned by you or badly protected.
>
> I suppose this is normal because ~/.netrc is by nature not protected
> at all. I check /etc/group and see I'm a member of the ssh group, but
> not the daemon or ssl-cert groups.

That message is normal if you want the file to be ignored:

http://tinyurl.com/nwu3vey

--
Dan Espen

Michael Albinus

unread,
Jan 17, 2015, 12:13:09 PM1/17/15
to Haines Brown, help-gn...@gnu.org
Haines Brown <hai...@histomat.net> writes:

> With a $ emacs -Q session I try:
>
> M-x customize-variable RET
> Customize variable: auth-source-debug [No match]

Again: ange-ftp.el (which handles ftp connections) does NOT use auth-sources.

Fix your problems with .netrc (proper permissions, maybe all entries in
one line) and it shall work.

> Haines

Best regards, Michael.

Haines Brown

unread,
Jan 17, 2015, 3:15:42 PM1/17/15
to
Michael Albinus <michael...@gmx.de> writes:

> Fix your problems with .netrc (proper permissions, maybe all entries in
> one line) and it shall work.

Michael, sorry to try your patience. Are you saying the message saying
there is a possible permissions problem with .netrc could somehow be
related to the format of its stanza? In any case. I already had tried
both inline and column format.

I need to do some kind of debug or trace on the command to see just what
is going on, but don't know how to do it.

It seems it is not just password, but the .netrc file that is not being
accessed. For example, with the line in .netrc:

machine uss-irex.info login Benutzer password Geheim

and accessed with command C-x -C-f /ftp:uss-irex.info, if I understand
the manual correctly, it should log into the Benutzer account. However,
the password prompt I get is:

Password for hai...@uss-irex.info

The manual suggests my account name (haines) is used if no other account
is specified. This suggests to me that ange-fpt is not seeing the login
information at all.

A year or two ange-ftp worked. Since then I upgraded debian to Wheezy, Emacs
to emacs 24, and reorganized emacs files (not relevant now because I'm
using $ emacs -Q).

Haines

Dan Espen

unread,
Jan 17, 2015, 6:32:39 PM1/17/15
to
Haines Brown <hai...@histomat.net> writes:

> Michael Albinus <michael...@gmx.de> writes:
>
>> Fix your problems with .netrc (proper permissions, maybe all entries in
>> one line) and it shall work.
>
> Michael, sorry to try your patience. Are you saying the message saying
> there is a possible permissions problem with .netrc could somehow be
> related to the format of its stanza? In any case. I already had tried
> both inline and column format.
>
> I need to do some kind of debug or trace on the command to see just what
> is going on, but don't know how to do it.

No you don't.
You already have the problem staring you in the face.

.netrc must have permissions:

-r--------

It won't work any other way.

--
Dan Espen

Haines Brown

unread,
Jan 18, 2015, 7:29:07 AM1/18/15
to
Dan Espen <des...@verizon.net> writes:

> Haines Brown <hai...@histomat.net> writes:
>>
>> I need to do some kind of debug or trace on the command to see just what
>> is going on, but don't know how to do it.
>
> No you don't.
> You already have the problem staring you in the face.
>
> .netrc must have permissions:
>
> -r--------
>
> It won't work any other way.

Dan, that was the answer! Now I understand the reason for the
permissions warning message. One would think man netrc would mention
this restriction.

A primitive -r-------- strikes me as a nuisance because I would have to
go through chmod just to modify the file, but I find that ange-ftp
also works with -rw-------.

Haines

Dan Espen

unread,
Jan 18, 2015, 9:15:06 PM1/18/15
to
Haines Brown <hai...@histomat.net> writes:

> Dan Espen <des...@verizon.net> writes:
>
>> Haines Brown <hai...@histomat.net> writes:
>>>
>>> I need to do some kind of debug or trace on the command to see just what
>>> is going on, but don't know how to do it.
>>
>> No you don't.
>> You already have the problem staring you in the face.
>>
>> .netrc must have permissions:
>>
>> -r--------
>>
>> It won't work any other way.
>
> Dan, that was the answer! Now I understand the reason for the
> permissions warning message. One would think man netrc would mention
> this restriction.

From "man netrc":

ftp will abort the auto-login process if the .netrc is readable by
anyone besides the user.

> A primitive -r-------- strikes me as a nuisance because I would have to
> go through chmod just to modify the file, but I find that ange-ftp
> also works with -rw-------.

Open the file with Emacs.
Just find the file as normal.
To change from read-only type ^x^q.
Make your changes.
Emacs will ask if it's okay when you save the file.

--
Dan Espen
0 new messages