manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.35k stars 197 forks source link

paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted #939

Closed getong closed 1 month ago

getong commented 1 month ago

macos ssh 连接有缓存,导致 lsp-bridge 发送 ssh 连接失败

ssh config

Host *
    ServerAliveInterval 30
    ControlMaster auto
    ControlPersist 30m
    ControlPath ~/.ssh/master-%r@%h:%p
    CheckHostIP no
    HashKnownHosts no

lsp-bridge 报错

Traceback (most recent call last):
  File "/Users/gerald/.emacs.d/var/straight/repos/lsp-bridge/core/remote_file.py", line 104, in connect_ssh
    ssh.connect(self.ssh_host, port=self.ssh_port, username=self.ssh_user, key_filename=ssh_private_key, look_for_keys=look_for_keys, sock=proxy)
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/client.py", line 485, in connect
    self._auth(
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/client.py", line 818, in _auth
    raise saved_exception
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/client.py", line 788, in _auth
    key = self._key_from_filepath(
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/client.py", line 638, in _key_from_filepath
    key = klass.from_private_key_file(key_path, password)
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/pkey.py", line 421, in from_private_key_file
    key = cls(filename=filename, password=password)
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/ed25519key.py", line 65, in __init__
    signing_key = self._parse_signing_key_data(data, password)
  File "/usr/local/Cellar/pypy3.10/7.3.15/libexec/lib/pypy3.10/site-packages/paramiko/ed25519key.py", line 98, in _parse_signing_key_data
    raise PasswordRequiredException(
paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted
manateelazycat commented 1 month ago

我没有mac,欢迎大佬发送补丁

getong commented 1 month ago

看起来像是误操作,我先关闭吧

getong commented 1 month ago

我的操作是这么操作的:

1 macos ssh 连接到远程服务器,中途离开,关闭 emacs,然后回来又打开 emacs。但 ssh 没有断开,后台 ssh 一直都在连接着。
2 在 dashboard 打开 sshx 文件, 然后就出现上面的 lsp-bridge 密码错误,lsp-bridge没有启动成功
3 切换到打开的文件,c-x c-j 打开 dired, 打开另外一个文件,跟上面的 sshx 文件不是同一个
   3.1 在这时就要输入 ssh 到远程服务器的密码了,然后 lsp-bridge 就启动正常了。
   3.2 最初那个sshx 打开的文件,关闭后重新打开,也正常了。

这个可能是使用特例吧。