SSH 别名登陆
!
目的在于学习 bash
背景
目的在于学习 bash
内容源于:tiankonguse
大佬Github项目
ssh免密登陆
1.本地生成密钥
ssh-keygen -t rsa -C "email@xxx.com"
ssh-add ~/.ssh/id_rsa
2.本地配置免密登陆
打开配置文件:~/.ssh/config
配置下面的内容
Host remote
HostName 192.168.0.1
User tiankonguse
Port 22
ServerAliveInterval 10
ControlMaster auto
IdentityFile ~/.ssh/id_rsa
设置权限:chmod 600 ~/.ssh/config
3.远程主机配置
将 ~/.ssh/id_rsa.pub
上传到远程主机。
执行:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
4.本地测试免密登陆
ssh tiankonguse@192.168.0.1
ssh别名登陆
大概如下:
Host one
HostName 192.168.0.1
Port 22
User tiankonguse
ServerAliveInterval 10
ControlMaster auto
IdentityFile ~/.ssh/id_rsa_tiankonguse
Host two
HostName 192.168.0.2
Port 22
User tiankonguse
ServerAliveInterval 10
ControlMaster auto
IdentityFile ~/.ssh/id_rsa_tiankonguse
登陆命令:ssh one
扩展链接
GitHub|bash-study - 传送阵
首次创建时间:2021-07-29 19:59:00
最后修改时间:2021-07-29 20:23:19
_(:3 」∠)_