Windows 生成无密码 SSH 密钥 + Linux 配置公钥

问题背景:Windows 上 bat 脚本调用 SSH 无法自动输入密码

Windows 生成无密码密钥

bat 复制代码
ssh-keygen -t ed25519 -N "" -f %USERPROFILE%\.ssh\id_ed25519

查看公钥内容:

bat 复制代码
type %USERPROFILE%\.ssh\id_ed25519.pub

复制输出内容。

Linux 配置公钥登录

bash 复制代码
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo '复制的公钥内容' >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

Windows 测试免密登录

bat 复制代码
ssh user@服务器IP

无需密码即成功。

相关推荐
CriticalThinking1 天前
在xshell中使用ssh隧道访问远程服务
linux·网络·ssh
m0_693200651 天前
VSCode使用ssh remote插件远程连接linux主机
linux·vscode·ssh
aosky2 天前
一台电脑配置多个 SSH Key 对应不同的 GitHub 账号
运维·ssh·github
Jurio.2 天前
tmux 安装与使用教程:SSH 断开后任务继续运行,终端分屏与多窗口管理
linux·经验分享·ssh·tmux
麦麦麦当劳大王2 天前
Linux SSH服务端配置指南
linux·运维·服务器·ssh
zh路西法3 天前
【SSH 免密登录全流程】Windows Linux 通用方案
linux·windows·ssh
高旭的旭3 天前
反向 SSH 隧道远程方案
运维·ssh
ICT系统集成阿祥3 天前
SSH连接交换机慢的原因&优化方案
运维·服务器·ssh
zahuilg104 天前
Mac原生终端SSH一键快捷连接|无需装软件、极简安装、快速上手
macos·ssh·github·终端