boxmoe_header_banner_img

Hello! 欢迎来到众归云!

文章导读

hermes配置web ui配置


avatar
王道 2026年6月9日 10

前提要上传公钥到服务器

第1步:生成密钥(如果之前已经生成了跳过这步)

cmd-命令行输入以下:获取公钥到本地生成

ssh-keygen -t ed25519

一路回车,不用填任何东西。

第2步:上传公钥到服务器

第2步,可以分步来:
  1. 先 ssh -p 4122 root@服务器IP   登上服务器
  2. 然后在服务器上执行:
    mkdir -p ~/.ssh && chmod 700 ~/.ssh
    echo “这里粘贴你公钥内容” >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
  3. 公钥内容在本地查看:

type C:\Users\Administrator\.ssh\id_ed25519.pub

 

目录C:\Users\Administrator\.ssh新建文件config
配置内容如下:
Host dashboard
          HostName 207.60.2.94
          Port 4122
          User root
          LocalForward 9119 127.0.0.1:9119
          # 可选:保持长连、断线自动重连
          ServerAliveInterval 30
          ServerAliveCountMax 3
          ExitOnForwardFailure yes

然后就可以直接:ssh dashboard

。。。。

 

免密不生效,常见几个原因,逐步排查:
1. 先确认公钥确实传上去了
SSH 登录服务器后执行:
cat ~/.ssh/authorized_keys
看看里面有没有你的公钥内容(以 ssh-ed25519 开头的一长串)
2. 检查服务器端权限和配置
登录服务器后执行:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
再检查 SSH 配置是否允许密钥登录:
grep -i “PubkeyAuthentication” /etc/ssh/sshd_config
如果显示 PubkeyAuthentication no,需要改成 yes
sed -i ‘s/PubkeyAuthentication no/PubkeyAuthentication yes/’ /etc/ssh/sshd_config
systemctl restart sshd
 检查 authorized_keys 是否被重复追加导致格式错误
cat -A ~/.ssh/authorized_keys
然后回本地测试:ssh -p 端口 root@你的IP
应该就能免密登录了,

https://www.coze.cn/session/7646460796586918144



评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字
插入代码