• sshd服务是远程登录服务,默认端口为22,对于其优化一是为了增加服务器的安全,避免暴力破解;二是为了加快速度连接,减少不必要的带宽的浪费。
  • sshd服务的配置文件为/etc/ssh/sshd_config,内容默认如下:
  1. # $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
  2. # This is the sshd server system-wide configuration file.  See
  3. # sshd_config(5) for more information.
  4. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
  5. # The strategy used for options in the default sshd_config shipped with
  6. # OpenSSH is to specify options with their default value where
  7. # possible, but leave them commented.  Uncommented options change a
  8. # default value.
  9. #Port 22    修改一下默认端口,增强安全性。比如6688等。
  10. #AddressFamily any
  11. #ListenAddress 0.0.0.0    修改一下监听端口,默认是监听所有的IP,这样安全性不是很高,我们可以让它监听内网的Ip,这样即使有人知道系统用户的密码也无法连接进来。
  12. #ListenAddress ::
  13. # Disable legacy (protocol version 1) support in the server for new
  14. # installations. In future the default will change to require explicit
  15. # activation of protocol 1
  16. Protocol 2
  17. # HostKey for protocol version 1
  18. #HostKey /etc/ssh/ssh_host_key
  19. # HostKeys for protocol version 2
  20. #HostKey /etc/ssh/ssh_host_rsa_key
  21. #HostKey /etc/ssh/ssh_host_dsa_key
  22. # Lifetime and size of ephemeral version 1 server key
  23. #KeyRegenerationInterval 1h
  24. #ServerKeyBits 1024
  25. # Logging
  26. # obsoletes QuietMode and FascistLogging
  27. #SyslogFacility AUTH
  28. SyslogFacility AUTHPRIV
  29. #LogLevel INFO
  30. # Authentication:
  31. #LoginGraceTime 2m
  32. #PermitRootLogin yes    将其改为no,不让root用户远程登录。
  33. #StrictModes yes
  34. #MaxAuthTries 6
  35. #MaxSessions 10
  36. #RSAAuthentication yes
  37. #PubkeyAuthentication yes
  38. #AuthorizedKeysFile     .ssh/authorized_keys
  39. #AuthorizedKeysCommand none
  40. #AuthorizedKeysCommandRunAs nobody
  41. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  42. #RhostsRSAAuthentication no
  43. # similar for protocol version 2
  44. #HostbasedAuthentication no
  45. # Change to yes if you don't trust ~/.ssh/known_hosts for
  46. # RhostsRSAAuthentication and HostbasedAuthentication
  47. #IgnoreUserKnownHosts no
  48. # Don't read the user's ~/.rhosts and ~/.shosts files
  49. #IgnoreRhosts yes
  50. # To disable tunneled clear text passwords, change to no here!
  51. #PasswordAuthentication yes
  52. #PermitEmptyPasswords no
  53. PasswordAuthentication yes
  54. # Change to no to disable s/key passwords
  55. #ChallengeResponseAuthentication yes
  56. ChallengeResponseAuthentication no
  57. # Kerberos options
  58. #KerberosAuthentication no
  59. #KerberosOrLocalPasswd yes
  60. #KerberosTicketCleanup yes
  61. #KerberosGetAFSToken no
  62. #KerberosUseKuserok yes
  63. # GSSAPI options
  64. #GSSAPIAuthentication no
  65. GSSAPIAuthentication yes   将这个值改为no ,加快连接速度。
  66. #GSSAPICleanupCredentials yes
  67. GSSAPICleanupCredentials yes
  68. #GSSAPIStrictAcceptorCheck yes
  69. #GSSAPIKeyExchange no
  70. # Set this to 'yes' to enable PAM authentication, account processing,
  71. # and session processing. If this is enabled, PAM authentication will
  72. # be allowed through the ChallengeResponseAuthentication and
  73. # PasswordAuthentication.  Depending on your PAM configuration,
  74. # PAM authentication via ChallengeResponseAuthentication may bypass
  75. # the setting of "PermitRootLogin without-password".
  76. # If you just want the PAM account and session checks to run without
  77. # PAM authentication, then enable this but set PasswordAuthentication
  78. # and ChallengeResponseAuthentication to 'no'.
  79. #UsePAM no
  80. UsePAM yes
  81. # Accept locale-related environment variables
  82. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
  83. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
  84. AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
  85. AcceptEnv XMODIFIERS
  86. #AllowAgentForwarding yes
  87. #AllowTcpForwarding yes
  88. #GatewayPorts no
  89. #X11Forwarding no
  90. X11Forwarding yes
  91. #X11DisplayOffset 10
  92. #X11UseLocalhost yes
  93. #PrintMotd yes
  94. #PrintLastLog yes
  95. #TCPKeepAlive yes
  96. #UseLogin no
  97. #UsePrivilegeSeparation yes
  98. #PermitUserEnvironment no
  99. #Compression delayed
  100. #ClientAliveInterval 0
  101. #ClientAliveCountMax 3
  102. #ShowPatchLevel no
  103. #UseDNS yes                 将yes改为no,不适用dns,我们本来就是用ip访问的。
  104. #PidFile /var/run/sshd.pid
  105. #MaxStartups 10:30:100
  106. #PermitTunnel no
  107. #ChrootDirectory none
  108. # no default banner path
  109. #Banner none
  110. # override default of no subsystems
  111. Subsystem       sftp    /usr/libexec/openssh/sftp-server
  112. # Example of overriding settings on a per-user basis
  113. #Match User anoncvs
  114. #       X11Forwarding no
  115. #       AllowTcpForwarding no
  116. #       ForceCommand cvs server
 
总结:修改5个地方
1,默认端口           Port 52113
2,不使用dns解析  UseDNS no
3,不让root用户直接登录  PermitRootlogin no 
4,GSSAPI验证改为no GSSAPIAuthentication no
5, 监听端口ip 改为内网的Ip。

sshd安全性能优化的更多相关文章

  1. linux 性能优化

    linux的性能优化: 1.CPU,MEM 2.DISK--RAID 3.网络相关的外设,网卡 linux系统性能分析: top:linux系统的负载,CPU,MEM,SWAP,占用CPU和内存比较的 ...

  2. linux的性能优化

    转一位大神的笔记. linux的性能优化: 1.CPU,MEM 2.DISK--RAID 3.网络相关的外设,网卡 linux系统性能分析: top:linux系统的负载,CPU,MEM,SWAP,占 ...

  3. 《Linux 性能优化实战—倪朋飞 》学习笔记 CPU 篇

    平均负载 指单位时间内,系统处于可运行状态和不可中断状态的平均进程数,即平均活跃进程数 可运行状态:正在使用CPU或者正在等待CPU 的进程,也就是我们常用 ps 命令看到的,处于 R 状态 (Run ...

  4. RHEL/CentOS通用性能优化、安全配置参考

    RHEL/CentOS通用性能优化.安全配置参考 本文的配置参数是笔者在实际生产环境中反复实践总结的结果,完全适用绝大多数通用的高负载.安全性要求的网络服务器环境.故可以放心使用. 若有异议,欢迎联系 ...

  5. Linux性能优化实战(一)

    一.优化方向 1,性能指标 从应用负载的视角出发,考虑"吞吐"和"延时" 从系统资源的视角出发,考虑资源使用率.饱和度等 2,性能优化步骤 选择指标评估应用程序 ...

  6. 01.SQLServer性能优化之----强大的文件组----分盘存储

    汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 文章内容皆自己的理解,如有不足之处欢迎指正~谢谢 前天有学弟问逆天:“逆天,有没有一种方 ...

  7. 03.SQLServer性能优化之---存储优化系列

    汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 概  述:http://www.cnblogs.com/dunitian/p/60413 ...

  8. Web性能优化:What? Why? How?

    为什么要提升web性能? Web性能黄金准则:只有10%~20%的最终用户响应时间花在了下载html文档上,其余的80%~90%时间花在了下载页面组件上. web性能对于用户体验有及其重要的影响,根据 ...

  9. Web性能优化:图片优化

    程序员都是懒孩子,想直接看自动优化的点:传送门 我自己的Blog:http://cabbit.me/web-image-optimization/ HTTP Archieve有个统计,图片内容已经占到 ...

随机推荐

  1. kaggle之Grupo Bimbo Inventory Demand

    Grupo Bimbo Inventory Demand kaggle比赛解决方案集合 Grupo Bimbo Inventory Demand 在这个比赛中,我们需要预测某个产品在某个销售点每周的需 ...

  2. iOS多线程及其感悟

    感觉每天都是匆匆忙忙的,每天似乎都是时间不够用一样,可是等真的想要动手敲代码的时候才发现,原来还有好多好多的知识点不是太熟练,所以,人不可以一直感觉自我良好, 有时间就是那种自我感觉良好的心态毁了自己 ...

  3. 总结oninput、onchange与onpropertychange事件的用法和区别 书写搜索的神奇代码

    总结oninput.onchange与onpropertychange事件的用法和区别 最近手机开发一个模糊搜索的功能组建,在网上就找到这篇文章! 前端页面开发的很多情况下都需要实时监听文本框输入,比 ...

  4. Oracle更改字符集

    更改oracle的字符集: sqlplus / as sysdba SQL> shutdown immediate; Database closed. Database dismounted. ...

  5. KVC与KVO的理解

    KVC与KVO是Objective C的关键概念. Key—Value Coding (KVC) 即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制间接访问对象的属性. ...

  6. protobuf 参考资料

    Protocol Buffers 官网下载地址:https://developers.google.com/protocol-buffers/docs/downloads Protocol Buffe ...

  7. jquery获取当前鼠标所在位置的坐标

    $(document).ready(function(){ $(document).mousemove(function(e){ $('#xy').html("X :"+e.pag ...

  8. PHP自动生成前端的表单框架

    <?php /** * 为当前所在菜单项样式 * @param string $controller_name * @param string $action_name * @param str ...

  9. CentOS 6.4 下安装 Apache

    下载地址:http://mirror.bit.edu.cn/ 参数 描述 prefix 安装目录 enable-rewrite 开启 rewrite 模块 sysconfdir 配置文件目录 ./co ...

  10. python笔记之bisect模块

    python笔记之bisect模块 当你决定使用二分搜索时,这个模块会给你带来很大的帮助. 例子 import bisect L = [1,3,3,6,8,12,15] x = 3 #在L中查找x,x ...