根据《ssh_config配置文件》 的介绍,这里做几个关于ssh_config文件配置的练习。
一、环境设定 1、假定使用ssh_config文件中的“/.ssh/config”文件/.ssh/dsl_private_key”
二、通过命令行方式与A,B,C上的SSH Server建立SSH连接 与A,B,C上的SSH Server建立SSH连接的命令分别如下所示:
1 ssh -i ~/.ssh/dsl_private_key -l dsl -p 1046 antix1.space.org 
1 ssh -i ~/.ssh/dsl_private_key -l dsl -p 1046 antix2.space.org 
1 ssh -i ~/.ssh/dsl_private_key -l dsl -p 1046 antix3.space.org 
三、通过ssh_config文件配置方式与A,B,C上的SSH Server建立SSH连接(不使用通配符,转义序列等高级配置) 现在“~/.ssh/config”文件中配置有如下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Host antix1       HostName antix1.space.org       User dsl       Port 1046       IdentityFile ~/.ssh/dsl_private_key      Host antix2       HostName antix2.space.org       User dsl       Port 1046       IdentityFile ~/.ssh/dsl_private_key      Host antix3       HostName antix3.space.org       User dsl       Port 1046       IdentityFile ~/.ssh/dsl_private_key   
与A,B,C上的SSH Server建立SSH连接的命令分别如下:
四、通过ssh_config文件配置方式与A,B,C上的SSH Server建立SSH连接(使用通配符,转义序列等高级配置) 现在“~/.ssh/config”文件中配置有如下内容:
1 2 3 4 5 Host antix*       HostName %h.space.org       User dsl       Port 1046       IdentityFile ~/.ssh/dsl_private_key   
与A,B,C上的SSH Server建立SSH连接的命令分别如下: