ssh-keyscan 返回的结果中缺少 ssh 密钥?

ssh-keyscan 返回的结果中缺少 ssh 密钥?

简而言之

[新手] 为什么我无法在返回的内容中找到用于连接到服务器的 SSH 密钥ssh-keyscan -H my_server_address


我租了一台基于 Debian 10 的专用服务器(卵巢癌) 服务器配置了 ECDSA SSH 密钥(以下称为wanax2root),我无需提供服务器 root 密码即可连接到服务器,没有任何警告/错误消息。我使用 ssh-agent,通过类似 的命令来提供信息ssh-add ~/.ssh/wanax1root-key-ecdsa

有关此 SSH 密钥的信息包括:

$ ssh-add -l
521 SHA256:1B0ZEojAQH5GJKB9+pTggVEJagOcSH47uHxQ6grmBiM wanax2root (ECDSA)

$ ssh-add -L
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFKLmZ/nafsLpIjm3gtEi95DK952807BCg87H+F2M0iEyBhJ1DFajdVi613/O16PEqroC2EzbKZkBRYZ8z7L7aa4wCbwtNaEBdIQU6yIqHZhR/Prpa1VtB9iLHlDZE9QEQf6GzwoIN/+l3/KYAPHVDTl8wdX0fdNrmkjw47rAPzr96qwA== wanax2root

服务器端一切正常,密钥是一样的:

$ cat /root/.ssh/authorized_keys 
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"debian\" rather than the user \"root\".';echo;sleep 10" ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFKLmZ/nafsLpIjm3gtEi95DK952807BCg87H+F2M0iEyBhJ1DFajdVi613/O16PEqroC2EzbKZkBRYZ8z7L7aa4wCbwtNaEBdIQU6yIqHZhR/Prpa1VtB9iLHlDZE9QEQf6GzwoIN/+l3/KYAPHVDTl8wdX0fdNrmkjw47rAPzr96qwA== wanax2root

出于好奇,我ssh-keyscan -H my_server_address在第一次登录此服务器之前和之后启动了一个命令。两次结果完全相同,这是正常的,因为 (1) SSH 密钥已由 OVH 配置,(2) 我没有通过 添加任何其他 ssh 密钥ssh-copy-id -i

我得到了以下几行:

# 5.XXX.XXX.XX:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
|1|eSa30X77kCbVk9pvkrOqqVeKjT8=|pIs7jxoQgjI3sGatLQuar/fTCTI= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL1yMDEEG7PiXI6cCIfFdzIVIDRd3cilQYWmel/C3gRV3Dnfsn++GJCvX9XavHJEeEV9vqx6nCdg7q3jJcHo18pqocFM3whQ07CJg7HHQHxPKDTM+X6eUFCZIl//u08yeT+YqttXran3Q4rPpbrIBaCN4M8AleQQhwpTE1wdKTuMZEzXTaY3umL8mf+fedJoDkwKKQAJhHm9xYRgfKf03ylC2R1b6HjjZ9lCwUa/SUul9ZghZLj1uu1ujpZnjksySSksmdgso96iSSObgOATRdtUafDrHd/CcDFybWNIz2pCdFcnT7JZtUovSjqoCMp1Ltx5TyYUKb8KOSx/ahgP5h
# 5.XXX.XXX.XX:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
|1|QPRBXqkMX0AZIJFKQKxNRND3Pr4=|C32YDldW/dFNWN/WxS8EFCSnh9I= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDTjzJA4/4IhkgwOtGNOYBE6e7sHYO0TUGKbwF52MS6p+X/0XUYNA7Nv8m4pUd/DqxqM3u8sz9waJHCLu8uEfr4=
# 5.XXX.XXX.XX:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
|1|ubggk67o1Mt6nT0o6jqKlXYEU5s=|aQLlAsU/lSTsKwwqVTVPz5UD3nU= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOk9LWiwQWjzXdvpnV5FJyElROVYyzU0bAeAPtMSEJNx
# 5.XXX.XXX.XX:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
# 5.XXX.XXX.XX:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2

我在这几行中找不到我的 SSH 密钥。当然有一个 ECDSA SSH 密钥,即:

|1|QPRBXqkMX0AZIJFKQKxNRND3Pr4=|C32YDldW/dFNWN/WxS8EFCSnh9I= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDTjzJA4/4IhkgwOtGNOYBE6e7sHYO0TUGKbwF52MS6p+X/0XUYNA7Nv8m4pUd/DqxqM3u8sz9waJHCLu8uEfr4=

但细节似乎表明事实并非如此我的SSH 密钥,即:

$ ssh-add -L
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFKLmZ/nafsLpIjm3gtEi95DK952807BCg87H+F2M0iEyBhJ1DFajdVi613/O16PEqroC2EzbKZkBRYZ8z7L7aa4wCbwtNaEBdIQU6yIqHZhR/Prpa1VtB9iLHlDZE9QEQf6GzwoIN/+l3/KYAPHVDTl8wdX0fdNrmkjw47rAPzr96qwA== wanax2root

文档没有帮助我。

欢迎任何帮助!我的 SSH 密钥在哪里?

答案1

你似乎混淆了主持人用您的个人钥匙用户键。这些是独立且不同的。

ssh_keyscan检索主持人指定主机的密钥。它对用户密钥不执行任何操作。

相关内容