欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  运维

ssh别名登录密钥登录实例教程

程序员文章站 2022-05-10 12:53:30
...
在centos上使用别名和是用密钥登录:
vim /root/.ssh/config #输入下列内容
Host *
User root #以root登录
ServerAliveInterval 60 #存活时间
#test1
Host q0 #登录的别名
HostName 10.10.10.1 #ip地址
User root
Port 22
IdentityFile ~/.ssh/skey_web #私钥的路径
#web1
Host q1
HostName 10.10.10.1
User root
Port 22
IdentityFile ~/.ssh/skey_web
把私钥传到上边定义的路径下修改权限:
chmod 600 ~/.ssh/skey_web
必须要改。只能是属主的才能读和写
然后重新启动ssh 试着登录一下:
ssh q1

以上就是ssh别名登录密钥登录实例教程的详细内容,更多请关注其它相关文章!