• 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. Git 多人协作的工作模式

    多人协作 148次阅读 当你从远程仓库克隆时,实际上Git自动把本地的master分支和远程的master分支对应起来了,并且,远程仓库的默认名称是origin. 要查看远程库的信息,用git rem ...

  2. 已解决 C# 调用 MySQLDriverCS 类库 报 vshost32-clr2.exe 已停止工作

    这几天修改一个项目是用C# 通过调用 MySQLDriverCS.dll 类库来操作 MySql数据库, 调试的会发生以上错误(直接运行是正常的),刚开始以为是兼容性问题,吧此错误百度上一粘贴有的人说 ...

  3. js将对象转成字符串-支持微信

    最近写一个微信项目时用到了 把对象转成字符串,因为我需要把它存在cookie中,碰到了一些问题,在这里分享一下. 要转换的就是这货~ var FBinf = { "workPlacesCod ...

  4. shell中的expr命令

    expr 可以进行的操作如下: 逻辑操作 arg1 | arg2 逻辑或操作,真则返回arg1,否则返回arg2(以null或者0来判断参数的真假,有短路功能) arg1 & arg2 逻辑与 ...

  5. 如何判断CPU的位数

    CPU是16位,32位,还是64位,主要指的是数据总线(data bus)有多少位,16位数据总线表示CPU一次可以从内存取2个byte的数据,32位数据总线表示CPU一次可以从内存取4byte数据, ...

  6. 给Array添加删除重复元素函数

    给Array本地对象增加一个原型方法,它用于删除数组中重复的元素(可能有多个重复), 返回值是一个包含被删除的重复条目的新数组. Array.prototype.distinct = function ...

  7. 问题汇总-20130927-关于rc.local命令无法执行

    场景:/etc/rc.local有语句 /usr/local/apache/bin/apachectl start mysql cactidb -u root -p123456 -e ' set gl ...

  8. linux bugfree 安装

    前段时间用了下bugzilla,请参考:linux bugzilla nginx 安装配置 详解,感觉不是很好用.下面说一下,bugfree的安装 bugfree3.0.1是用php的yii框架开发的 ...

  9. 小希的迷宫(HDU 1272 并查集判断生成树)

    小希的迷宫 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  10. poj 1036 Gangsters

    http://poj.org/problem?id=1036 题意:N个土匪,伸缩门的范围是K, 时间T, 伸缩门在[0, k]范围内变动,每个单位时间可以不变伸长或者缩短一个单位.给出每个最烦到达的 ...