3分钟学会SSH

👋3分钟学会SSH

⚽️场景介绍

  1. windows to linux
windows 客户端连接到 linux 服务器
  1. linux to linux
linux 客户端连接到 linux 服务器

⚽️windows to linux

⚾️流程

  1. linux 服务器安装并配置 sshd
  2. windows 客户端生成密钥
  3. windows 客户端将密钥添加到 linux 服务器
  4. windows 客户端登录测试

⚾️实操

  1. 服务器配置 sshd
# 安装 sshd
yum install sshd -y
# 编辑 sshd_config 文件
vim /etc/ssh/sshd_config

# 开启以下配置
# RSAAuthentication yes
# PubkeyAuthentication yes
# AuthorizedKeysFile      .ssh/authorized_keys

# 重启 sshd 服务
systemctl restart sshd
  1. 客户端生成密钥
ssh-keygen -t ed25519 -C "main"

生成密钥

  1. 客户端密钥添加到服务器
cat >> ~/.ssh/authorized_keys << EOF
[id_ed25519.pub value]
EOF
  1. 客户端登录测试

测试

⚽️linux to linux

⚾️流程

  1. 服务器安装并配置 sshd
  2. 客户端生成密钥
  3. 客户端将密钥添加到服务器
  4. 客户端登录测试

⚾️实操

  1. 服务器安装并配置 sshd
# 安装 sshd
yum install sshd -y
# 编辑 sshd_config 文件
vim /etc/ssh/sshd_config

# 开启以下配置
# RSAAuthentication yes
# PubkeyAuthentication yes
# AuthorizedKeysFile      .ssh/authorized_keys

# 重启 sshd 服务
systemctl restart sshd
  1. 客户端生成密钥
ssh-keygen -t ed25519 -C "node1"

生成密钥

  1. 客户端将密钥添加到服务器
cat ~/.ssh/id_ed25519.pub | ssh root@main 'cat >> .ssh/authorized_keys'
  1. 客户端登录测试
ssh root@main

👬 交友小贴士:
博主GithubGitee同名账号,Follow 一下就可以一起愉快的玩耍了,更多精彩文章请持续关注。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

峰sir~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值