栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

CentOS 免密登录远程主机

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CentOS 免密登录远程主机

CentOS 免密登录远程主机 步骤1

用 ssh-key-gen 在本地主机上创建公钥和密钥
root@local-host$ ssh-keygen -t rsa
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
root@local-host

步骤2

用 ssh-copy-id 把公钥复制到远程主机上(.ssh/authorized_key文件)
root@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@{目标IP}
root@remote-host‘s password:
Now try logging into the machine, with ―ssh ?remote-host‘‖, and check in:
.ssh/authorized_keys to make sure we haven‘t added extra keys that you weren‘t expecting.

步骤3

直接登录远程主机
root@local-host$ ssh root@{目标IP}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/826278.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号