通过编写配置文件config ssh链接主机

①在家目录下创建.ssh隐藏文件夹,然后创建config文件

mkdir .ssh

cd .ssh/

通过编写配置文件config ssh链接主机

vim config        #编写config文件

host "imooc"
    HostName 192.168.123.34                                
    User root
    Port 22

通过编写配置文件config ssh链接主机

然后就可以

ssh imooc     #通过配置文件连接主机

通过编写配置文件config ssh链接主机

配置多台主机的写法

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

连接上了我的这台云主机了

②ssh安全免密码登录:ssh key

window下面实现免密登陆:

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

复制桌面生成的公钥的内容

在.ssh目录下创建     vim authorized_keys   

将公钥的内容粘贴进去   保存退出 然后用xshell

通过编写配置文件config ssh链接主机

通过编写配置文件config ssh链接主机

打开这个连接就实现的免密登陆linux了    就是这边带着公钥去访问linux有的公钥就不需要密码了

linux下生成秘钥公钥

ssh-******

查看生成的秘钥公钥     ls -al

通过编写配置文件config ssh链接主机

shift+4就是$    快速到行位

未完