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
    • 最新
    • 标签
主页 / unix / 问题 / 751704
Accepted
admstg
admstg
Asked: 2023-07-18 01:04:44 +0800 CST2023-07-18 01:04:44 +0800 CST 2023-07-18 01:04:44 +0800 CST

SSH 密钥问题 - Fedora 38

  • 772

我有一个至少有 2 个用户(root 和我自己)的远程服务器。我在两个 $HOME 文件夹中的 .ssh/authorized_keys 中有相同的密钥。我可以连接 root 帐户,但从我的帐户中出现“ Server refused our key”错误。我已经检查了 sshd_config (在服务器上)和 .ssh 文件夹以检查是否有错误。由于我对两个帐户使用相同的密钥 ed25519 我不知道。我唯一能看到的是UsePAM yes/etc/ssh/sshd_config.d/50-redhat.conf,但是如果我删除它,我将无法使用 passwd 登录。

这是 ssh -v 结果

[stan@DEL-3KC0G63 ~]$ ssh -v -i /mnt/c/Users/s.garret
/.ssh/id_ed25519 stan@192.168.1.28
OpenSSH_8.0p1, OpenSSL 1.1.1k  FIPS 25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: configuration requests final Match pass
debug1: re-parsing configuration
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: Connecting to 192.168.1.28 [192.168.1.28] port 22.
debug1: Connection established.
debug1: identity file /mnt/c/Users/s.garret/.ssh/id_ed25519 type 3
debug1: identity file /mnt/c/Users/s.garret/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.0
debug1: match: OpenSSH_9.0 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.28:22 as 'stan'
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: aes256-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:LjRh07mgxeC37wDufL2WmbYVYTY0tKHptZSSZGc1Q3U
debug1: Host '192.168.1.28' is known and matches the ECDSA host key.
debug1: Found key in /home/stan/.ssh/known_hosts:3
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /mnt/c/Users/s.garret/.ssh/id_ed25519 ED25519 SHA256:DF1VjlJzo51HzV0TQgCcKnRCZXlhr9rCwiJuZBZzVZU explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available: Invalid UID in persistent keyring name


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available: Invalid UID in persistent keyring name


debug1: Next authentication method: publickey
debug1: Offering public key: /mnt/c/Users/s.garret/.ssh/id_ed25519 ED25519 SHA256:DF1VjlJzo51HzV0TQgCcKnRCZXlhr9rCwiJuZBZzVZU explicit
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: password
stan@192.168.1.28's password:
debug1: Authentication succeeded (password).

以及 ssh 文件夹上 ls -la 的结果:

[stan@metal ~]$ ls -la .ssh/
total 24
drwx------.  2 stan stan 4096 17 juil. 18:20 .
drwxrwxr-x. 53 stan stan 4096 17 juil. 18:38 ..
-rw-------.  1 stan stan  115  4 juil. 08:34 authorized_keys
-rw-------.  1 stan stan 2622 16 févr.  2020 id_rsa
-rw-------.  1 stan stan  582 16 févr.  2020 id_rsa.pub
-rw-------.  1 stan stan 1361 16 mai   18:33 known_hosts
[stan@metal ~]$
ssh
  • 1 1 个回答
  • 33 Views

1 个回答

  • Voted
  1. Best Answer
    Rui F Ribeiro
    2023-07-18T21:29:48+08:002023-07-18T21:29:48+08:00

    SSH为了你自身的安全做了一些安全限制。虽然 ~/.ssh 下的所有内容看起来都不错,但 stan $HOME 在 775/rwxrwxr-x 处过于开放,根据您的 .. 在您的 .ssh 目录ls输出中。

    如果以 stan 身份运行:

    chmod 700 $HOME
    

    或者如果是根:

    chmod 700 ~stan 
    

    现在你的 ssh 应该可以工作了。

    • 2

相关问题

  • 为什么 ssh 实用程序被视为 pty?

  • Auto-SSH 手动工作,但不在后台工作

  • 远程运行 X 应用程序,在远程主机上运行 GUI [关闭]

  • rsync 端口 22 和 873 使用

  • SCP突然中止:管道损坏,消息验证码不正确

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve