I found a related thread that describes how to login to a remote server using sshpass
:
sshpass -p '<password>' <ssh/scp command>
How can logging in with password be accomplished in Emacs / Tramp?
I presently use the following and then enter the password manually:
C-x C-f /ssh:user@server:/home/user/public_html/
I have the following function, that I access from my right-click context pop-up menu:
(defun lawlist-remote-server-login ()
(interactive)
(find-file "/ssh:user@server:/home/user/public_html/"))
If you're simply trying to avoid typing your password, but you don't want to use SSH keys, you can use an authentication file.
From the TRAMP user manual:
4.12.1 Using an authentication file
The package auth-source.el
, originally developed in No Gnus, offers
the possibility to read passwords from a file, like FTP does it from
~/.netrc
. The default authentication file is ~/.authinfo.gpg
, this can
be changed via the variable auth-sources
.
A typical entry in the authentication file would be
machine melancholia port scp login daniel password geheim
The port can be any tramp method (see Inline methods, see External
methods), to match only this method. When you omit the port, you match
all tramp methods.
In case of problems, setting auth-source-debug
to t
gives useful debug
messages.
Edit:
The specific code that worked for the OP without requiring GnuPG is reproduced below.
Emacs configuration:
(setq auth-sources '("/Users/HOME/.0.data/.0.emacs/.authinfo"))
And in the .authinfo
file identified above:
machine 12.34.56.789 login lawlist password 12345678 port ssh