
首席执行官-CEO
- UID
- 1
- 金叶子
- 86
- 在线时间
- 199 小时
- 注册时间
- 2023-10-27
- 最后登录
- 2026-7-25
|
先建目录:
mkdir $env:USERPROFILE\.ssh -Force
再生成 key:
ssh-keygen -t ed25519 -f "$env:USERPROFILE\.ssh\war_mail_patch"
它会提示:
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
这两次都直接按回车,不输入东西。
然后看公钥:
type "$env:USERPROFILE\.ssh\war_mail_patch.pub"
把输出的整行 ssh-ed25519 ... 复制到服务器的:
mkdir -p /root/.ssh
chmod 700 /root/.ssh
cat >> /root/.ssh/authorized_keys
粘贴公钥,回车,然后 Ctrl+D。
再执行:
chmod 600 /root/.ssh/authorized_keys
Windows 测试:
ssh -i "$env:USERPROFILE\.ssh\war_mail_patch" root@192.168.0.128 "hostname; pwd"
SSH 已通:root@192.168.0.128
key 路径:C:\Users\Administrator\.ssh\war_mail_patch
|
|