1[root@dns01 dns_rsync]# cat /etc/ssh/ssh_config 2 # Site-wide defaults for various options 3 Host * 4 ForwardAgent no 5 ForwardX11 no 6 RhostsAuthentication no 7 RhostsRSAAuthentication no 8 RSAAuthentication yes 9 PasswordAuthentication yes 10 FallBackToRsh no 11 UseRsh no 12 BatchMode no 13 CheckHostIP yes 14 StrictHostKeyChecking no 15 IdentityFile ~/.ssh/identity 16 Port 22 17 Cipher blowfish 18 EscapeChar ~ 19 20 下面对上述选项参数逐进行解释: 21 # Site-wide defaults for various options 22 带“#”表示该句为注释不起作,该句不属于配置文件原文,意在说明下面选项均为系统初始默认的选项。说明一下,实际配置文件中也有很多选项前面加有“#”注释,虽然表示不起作用,其实是说明此为系统默认的初始化设置。 23 Host * 24"Host"只对匹配后面字串的计算机有效,“*”表示所有的计算机。从该项格式前置一些可以看出,这是一个类似于全局的选项,表示下面缩进的选项都适用于该设置,可以指定某计算机替换*号使下面选项只针对该算机器生效。 25 ForwardAgent no 26"ForwardAgent"设置连接是否经过验证代理(如果存在)转发给远程计算机。 27ForwardX11 no 28"ForwardX11"设置X11连接是否被自动重定向到安全的通道和显示集(DISPLAY set)。 29RhostsAuthentication no 30"RhostsAuthentication"设置是否使用基于rhosts的安全验证。 31RhostsRSAAuthentication no 32"RhostsRSAAuthentication"设置是否使用用RSA算法的基于rhosts的安全验证。 33RSAAuthentication yes 34"RSAAuthentication"设置是否使用RSA算法进行安全验证。 35PasswordAuthentication yes 36"PasswordAuthentication"设置是否使用口令验证。 37FallBackToRsh no 38"FallBackToRsh"设置如果用ssh连接出现错误是否自动使用rsh,由于rsh并不安全,所以此选项应当设置为"no"。 39UseRsh no 40"UseRsh"设置是否在这台计算机上使用"rlogin/rsh",原因同上,设为"no"。 41BatchMode no 42"BatchMode":批处理模式,一般设为"no";如果设为"yes",交互式输入口令的提示将被禁止,这个选项对脚本文件和批处理任务十分有用。 43CheckHostIP yes 44"CheckHostIP"设置ssh是否查看连接到服务器的主机的IP地址以防止DNS欺骗。建议设置为"yes"。 45StrictHostKeyChecking no 46"StrictHostKeyChecking"如果设为"yes",ssh将不会自动把计算机的密匙加入"$HOME/.ssh/known_hosts"文件,且一旦计算机的密匙发生了变化,就拒绝连接。 47IdentityFile ~/.ssh/identity 48"IdentityFile"设置读取用户的RSA安全验证标识。 49 50Port 22 51"Port"设置连接到远程主机的端口,ssh默认端口为22。 52Cipher blowfish 53“Cipher”设置加密用的密钥,blowfish可以自己随意设置。 54EscapeChar ~ 55“EscapeChar”设置escape字符。<br> 56================================================================================= 57比如说,A机器的ssh端口是22,B机器的端口是22222,一般来说A机器ssh连接B机器的时候是使用-p22222指定端口。但是可以修改A机器的/etc/ssh/ssh_config文件中的Port为22222,这样A机器ssh连接的时候就默认使用22222端口了。
服务热线
1391-024-6332