ssh配置免密登录服务器

1. Windows客户机生成.pub文件

bash 复制代码
# Windows
ssh-keygen -t rsa
# <username>/.ssh/*.pub

2. 复制pub文件到服务器

bash 复制代码
# Windows
# 假设远程主机名为example.com,用户名为user
scp id_rsa.pub <user>@<example.com>:~/

3. 服务器将.pub文件标记为authorized_keys

bash 复制代码
# Linux
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

4. Windows配置.ssh\config文件, 示例, 具体项目自己改

bash 复制代码
HostName <ip addr or domain name, 111.10.111.10>
Port <22> # default port
User <root> # Your username
IdentitiesOnly yes

5. 测试连接,你试试看

bash 复制代码
# windows
ssh root
相关推荐
8***8482几秒前
Nginx三种安装方式
运维·nginx
咖啡の猫5 分钟前
Python分支结构
服务器·网络·python
没有口袋啦12 分钟前
《基于iptables的nginx的https的搭建》
linux·服务器·网络
凉、介16 分钟前
Linux 下的 time_before/time_after 接口
linux·运维·服务器·学习
_kank_16 分钟前
SSH 深度实战:从基础到高级安全配置
ssh
dustcell.31 分钟前
nginx的https搭建
运维·nginx·https
last demo32 分钟前
VSFTPD 服务器
linux·运维·服务器
Azure DevOps33 分钟前
Azure DevOps Server:允许讨论但不允许修改工作项
运维·microsoft·azure·devops
阿阿越34 分钟前
Linux系统编程 -- 进程(二)
linux·运维·服务器