AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[ssh-keygen](server)

Martin Hope
CRThaze
Asked: 2022-02-08 09:48:24 +0800 CST

SSH 密钥指纹更改

  • 0

所以我将一个 SSH 私钥从我的 Linux 机器复制到了我的 M1 Mac。(我试图通过将密文上传到秘密管理器以及直接传输文件来做到这一点)但是当尝试从每个机器通过 SSH 连接到同一台机器时,我只能从 Linux 机器上成功。

Linux机器:

$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f  31 Mar 2020
$ md5sum id_rsa
7ed8b0c73e168ef48acc715d4c6bcf73  id_rsa
$ sha256sum id_rsa
969d0a35b36c50035881bdd2d8367b90dbff548131d5c72989d29e83b7a3aa19  id_rsa
$ ssh-keygen -l -f id_rsa
4096 SHA256:d19Ee+tlzVHitLzKuuZbdgYcnhla96ypXNtpBwrqfqE redacted@redacted.com (RSA)
$ ssh -i id_rsa crthaze@ec2-55-55-55-55.compute-1.amazonaws.com
[redacted MOTD; WORKS]

M1 麦克:

$ ssh -V
openSSH_8.6p1, LibreSSL 2.8.3
$ md5 id_rsa
MD5 (id_rsa) = 7ed8b0c73e168ef48acc715d4c6bcf73
$ shasum -a 256 id_rsa
969d0a35b36c50035881bdd2d8367b90dbff548131d5c72989d29e83b7a3aa19  id_rsa
$ ssh-keygen -l -f id_rsa
4096 SHA256:rWsP9jN2otlchh8icr/jlnZxDjEfEkngDJOoPh4RYZI redacted@redacted.com (RSA)
$ ssh -i id_rsa crthaze@ec2-55-55-55-55.compute-1.amazonaws.com
crthaze@ec2-55-55-55-55.compute-1.amazonaws.com: Permission denied (publickey).

AFAICT 这些私钥是相同的。但是由于某种原因 ssh-keygen 不会对它们进行相同的指纹识别。即使它们具有相同的校验和。这可能是 M1 SoC 的问题吗?还是这里发生了更明显的事情?

linux mac ssh ssh-keys ssh-keygen
  • 1 个回答
  • 614 Views
Martin Hope
Kirra Lissa
Asked: 2021-09-21 10:32:11 +0800 CST

即使在我将公钥复制到远程机器之后,SSH 也会要求输入密码

  • 0

希望有人能帮我解决这个噩梦。我做了一个关于 vagrant 配置 4 台 ubuntu 机器、1 台控制器和 3 台服务器的项目。在控制器和 ssh-copy-id 命令上创建 SSH 密钥到 3 个服务器节点。我可以在 3 台服务器上的 authorized_keyes 中看到公钥。

根据我在互联网上可以找到的内容,etc/ssh/sshd_config 转储似乎没问题。

#       $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile     .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem       sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server
UseDNS no
GSSAPIAuthentication no

当我尝试从我的控制器机器连接到其中一台服务器时调试输出。

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config     
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to server1 [172.16.1.51] port 22.       
debug1: Connection established.
debug1: identity file /home/vagrant/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to server1:22 as 'vagrant'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Qe4c4KKdHXNjhZ3PMFqTKrVFASCX3O8kvtCRKTifkfs
debug1: Host 'server1' is known and matches the ECDSA host key.
debug1: Found key in /home/vagrant/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:gmW3Caq3TNEnCYHCa+BMgMm7lINsBlo7Y73bE596LZo /home/vagrant/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
Enter passphrase for key '/home/vagrant/.ssh/id_rsa':

我已经尝试了大部分我能找到的关于这个主题的东西。我仍然无法无密码访问我的服务器机器。欢迎任何建议。

谢谢你。

linux ssh ssh-keys ssh-keygen
  • 3 个回答
  • 582 Views
Martin Hope
TheHidden
Asked: 2021-02-17 13:38:50 +0800 CST

如何生成一个小的 RSA 密钥

  • 0

我想要,ssh-keygen -t rsa -b 512但我的 linux 太“最新”了,不允许这样做。无论如何将设置修改为:

  1. 生成 512 位密钥
  2. 让我使用该密钥对服务器进行身份验证

是的,我知道它不好的安全做法,但我实际上正在做一些安全研究。这台机器将被烧毁,没有任何价值。这纯粹是为了研究

ssh ssh-keygen
  • 2 个回答
  • 286 Views
Martin Hope
Karoh
Asked: 2020-10-25 08:44:02 +0800 CST

将 ssh 密钥添加到新服务器,而之前没有在该服务器上设置用户

  • 3

我已经使用 Hetzner 设置了一个运行 Ubuntu 20.04 LTS 的全新 VPS,并希望通过 ssh 访问它。

这是我尝试做的事情:

  1. 我在 Hetzner 的在线 GUI 中添加了我的公共 ssh 密钥(无密码)。看起来像这样:
ssh-rsa blahblahblah= my.name@gmail.com
  1. 但是当我尝试将ssh-copy-id这个密钥连接到服务器时,我遇到了问题。由于我还没有登录到服务器来创建用户,我不知道user在这个命令中该放什么:
ssh-copy-id -i .ssh/id_rsa_pub [user]@serveraddress

我尝试将密钥添加到 root 用户,如下所示:

ssh-copy-id -i .ssh/id_rsa_pub [user]@serveraddress

但随后我被提示输入我不知道的密码。


这使我想到了以下我很难找到答案的问题:

1.如果我还没有设置用户,如何使用ssh-copy-id将我的公钥复制到服务器?

2.服务器的默认root密码是多少?我怎么会发现这个?我已经尝试过ubuntu,,,root基础。

3.在服务器主机的网站上通过GUI添加公钥通常对服务器用户有什么作用?它是否将密钥添加到known_hosts文件中?

4.目前,我的公共 ssh 密钥中最后一条注释行的技术意义是什么my.name@gmail.com?

ssh vps hetzner ssh-keys ssh-keygen
  • 1 个回答
  • 2916 Views
Martin Hope
Bhalu
Asked: 2020-07-23 21:29:45 +0800 CST

如何安全地卸载 ssh-keygen 实用程序?[复制]

  • -1
这个问题在这里已经有了答案:
强制使用 SSH 密钥密码? (6 个回答)
2年前关闭。

我的任务是从 Ubuntu 服务器中删除 ssh-keygen,我不想破坏计算机。你能帮忙吗,如何安全地卸载 ssh-keygen 实用程序?

谢谢

linux ubuntu ssh ssh-keys ssh-keygen
  • 1 个回答
  • 303 Views
Martin Hope
kch
Asked: 2009-08-06 23:29:25 +0800 CST

RSA 或 DSA:生成 SSH 密钥对时的明确答案是什么?[复制]

  • 9
这个问题在这里已经有了答案:
13年前关闭。

可能重复:
SSH 密钥对生成:RSA 还是 DSA?

有人说用RSA,有人说用DSA,有人说没关系。

有人说一个比另一个更安全,有人说相反。

有人说这是专利问题。

  • 那么,这里的真实故事是什么?利弊之类的?
  • 最终两者都可以,但对于挑剔的安全意识的人来说,哪一个更合适?
  • 是否应该为要求整个公司使用相同的加密而烦恼?

更新

啊,原来这是对q40071的精确欺骗,并且接受的答案是可以的。

ssh encryption ssh-keygen
  • 3 个回答
  • 1151 Views
Martin Hope
kch
Asked: 2009-08-06 21:37:57 +0800 CST

如何更改我的私钥密码?

  • 400

我有一个现有的公钥/私钥对。私钥受密码保护,加密可以是 RSA 或 DSA。这些密钥是您生成的类型ssh-keygen,通常存储在~/.ssh.

我想更改私钥的密码。在标准的 Unix shell 上,我该怎么做?

另外,我如何简单地删除密码?直接改成空的?

unix ssh ssh-keygen passphrase
  • 3 个回答
  • 310239 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve