Passwords in Emacs tramp mode editing
Asked Answered
D

5

16

I'm using emacs tramp mode to remotely edit files over ssh. The problem is that every time I save the file I'm editing I have to enter my user password. I find that very annoying. How can I write my password only once / editing session?

Damiondamita answered 8/5, 2009 at 15:8 Comment(0)
C
18

Ah, from the tramp docs on password caching you can set:

(setq password-cache-expiry nil)

which requires the package password-cache.el.

Also, in the tramp sources, it mentions reading the ssh-agent(1) man page, which shows how to set it up so that you don't have to re-enter passwords (inside, or outside of Emacs):

There are two main ways to get an agent set up: The first is that the agent starts a new subcommand into which some environment variables are exported, eg ssh-agent xterm &. The second is that the agent prints the needed shell commands (either sh(1) or csh(1) syntax can be generated) which can be evalled in the calling shell, eg eval ssh-agent -s for Bourne-type shells such as sh(1) or ksh(1) and eval ssh-agent -c for csh(1) and derivatives.

Climacteric answered 8/5, 2009 at 15:33 Comment(1)
The package name is package-cache.Silicious
C
5
(setq password-cache-expiry nil)
Celiaceliac answered 8/5, 2009 at 15:36 Comment(1)
Should this go into my .emacs file?Damiondamita
S
4

In addition to Trey Jackson's solution, there are a few more ways you can choose:

Silicious answered 8/5, 2009 at 15:55 Comment(0)
J
1

Using public key (RSA) authentication is more secure and much more convenient. On a GNU/Linux system (and maybe others, I don't know) you typically would unlock your private key once per login session with a password and then use it.

Javierjavler answered 9/5, 2009 at 16:12 Comment(0)
B
0

use SSH public key authentication.

Bingle answered 9/5, 2009 at 5:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.