追梦者的IT技术博客

今天是

现在位置:首页 » freebsd » FreeBSD 10.2 设置sshd

FreeBSD 10.2 设置sshd
作者:admin   分类:freebsd   评论(0)   浏览(1138)   关键词: FreeBSD 10.2 设置sshd

FreeBSD 10.2 设置sshd

因为笔者爱好FreeBSD,于是乎说干就干用了虚机装了FreeBSD 10。各种等待后系统终于安装完成但因为在虚拟机中操作不方便,于是决定用ssh远程操作系统。之前笔者也研究过配置方法,但最终以失败告终。终于在今天笔者多方查找资料后找到了开启的方式,现在我将方法分享给大家希望可以帮助到和笔者有同样问题的朋友。

首先用cd命令切换到/etc/ssh/sshd_config 再用vi命令编辑

	
  1. root@bsdserver:/etc/ssh # vi sshd_config
  2.  
  3.  
  4. # $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $
  5. # $FreeBSD: releng/10.2/crypto/openssh/sshd_config 264692 2014-04-20 12:46:18Z des $
  6.  
  7. # This is the sshd server system-wide configuration file. See
  8. # sshd_config(5) for more information.
  9.  
  10. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
  11.  
  12. # The strategy used for options in the default sshd_config shipped with
  13. # OpenSSH is to specify options with their default value where
  14. # possible, but leave them commented. Uncommented options override the
  15. # default value.
  16.  
  17. # Note that some of FreeBSD's defaults differ from OpenBSD's, and
  18. # FreeBSD has a few additional options.
  19.  
  20. #Port 22
  21. #AddressFamily any
  22. #ListenAddress 0.0.0.0
  23. #ListenAddress ::
  24.  
  25. # The default requires explicit activation of protocol 1
  26. #Protocol 2
  27.  
  28. # HostKey for protocol version 1
  29. #HostKey /etc/ssh/ssh_host_key
  30. # HostKeys for protocol version 2
  31. #HostKey /etc/ssh/ssh_host_rsa_key
  32. #HostKey /etc/ssh/ssh_host_dsa_key
  33. #HostKey /etc/ssh/ssh_host_ecdsa_key
  34. #HostKey /etc/ssh/ssh_host_ed25519_key
  35.  
  36. # Lifetime and size of ephemeral version 1 server key
  37. #KeyRegenerationInterval 1h
  38. #ServerKeyBits 1024
  39.  
  40. # Ciphers and keying
  41. #RekeyLimit default none
  42.  
  43. # Logging
  44. # obsoletes QuietMode and FascistLogging
  45. #SyslogFacility AUTH
  46. #LogLevel INFO
  47.  
  48. # Authentication:
  49.  
  50. #LoginGraceTime 2m
  51. #PermitRootLogin no
  52. #StrictModes yes
  53. #MaxAuthTries 6
  54. #MaxSessions 10
  55.  
  56. #RSAAuthentication yes
  57. #PubkeyAuthentication yes
  58.  
  59. # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
  60. #AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
  61.  
  62. #AuthorizedPrincipalsFile none
  63.  
  64. #AuthorizedKeysCommand none
  65. #AuthorizedKeysCommandUser nobody
  66.  
  67. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  68. #RhostsRSAAuthentication no
  69. # similar for protocol version 2
  70. #HostbasedAuthentication no
  71. # Change to yes if you don't trust ~/.ssh/known_hosts for
  72. # RhostsRSAAuthentication and HostbasedAuthentication
  73. #IgnoreUserKnownHosts no
  74. # Don't read the user's ~/.rhosts and ~/.shosts files
  75. #IgnoreRhosts yes
  76.  
  77. # Change to yes to enable built-in password authentication.
  78. #PasswordAuthentication no
  79. #PermitEmptyPasswords no
  80.  
  81. # Change to no to disable PAM authentication
  82. #ChallengeResponseAuthentication yes
  83.  
  84. # Kerberos options
  85. #KerberosAuthentication no
  86. #KerberosOrLocalPasswd yes
  87. #KerberosTicketCleanup yes
  88. #KerberosGetAFSToken no
  89.  
  90. # GSSAPI options
  91. #GSSAPIAuthentication no
  92. #GSSAPICleanupCredentials yes
  93.  
  94. # Set this to 'no' to disable PAM authentication, account processing,
  95. # and session processing. If this is enabled, PAM authentication will
  96. # be allowed through the ChallengeResponseAuthentication and
  97. # PasswordAuthentication. Depending on your PAM configuration,
  98. # PAM authentication via ChallengeResponseAuthentication may bypass
  99. # the setting of "PermitRootLogin without-password".
  100. # If you just want the PAM account and session checks to run without
  101. # PAM authentication, then enable this but set PasswordAuthentication
  102. # and ChallengeResponseAuthentication to 'no'.
  103. #UsePAM yes
  104.  
  105. #AllowAgentForwarding yes
  106. #AllowTcpForwarding yes
  107. # and session processing. If this is enabled, PAM authentication will
  108. # be allowed through the ChallengeResponseAuthentication and
  109. # PasswordAuthentication. Depending on your PAM configuration,
  110. # PAM authentication via ChallengeResponseAuthentication may bypass
  111. # the setting of "PermitRootLogin without-password".
  112. # If you just want the PAM account and session checks to run without
  113. # PAM authentication, then enable this but set PasswordAuthentication
  114. # and ChallengeResponseAuthentication to 'no'.
  115. #UsePAM yes
  116.  
  117. #AllowAgentForwarding yes
  118. #AllowTcpForwarding yes
  119. #GatewayPorts no
  120. #X11Forwarding yes
  121. #X11DisplayOffset 10
  122. #X11UseLocalhost yes
  123. #PermitTTY yes
  124. #PrintMotd yes
  125. #PrintLastLog yes
  126. #TCPKeepAlive yes
  127. #UseLogin no
  128. #UsePrivilegeSeparation sandbox
  129. #PermitUserEnvironment no
  130. #Compression delayed
  131. #ClientAliveInterval 0
  132. #ClientAliveCountMax 3
  133. #UseDNS yes
  134. #PidFile /var/run/sshd.pid
  135. #MaxStartups 10:30:100
  136. #PermitTunnel no
  137. #ChrootDirectory none
  138. #VersionAddendum FreeBSD-20140420
  139.  
  140. # no default banner path
  141. #Banner none
  142.  
  143. # override default of no subsystems
  144. Subsystem sftp /usr/libexec/sftp-server
  145.  
  146. # Disable HPN tuning improvements.
  147. #HPNDisabled no
  148.  
  149. # Buffer size for HPN to non-HPN connections.
  150. #HPNBufferSize 2048

#PermitRootLogin no  前面的#号去掉 再把no改为yes即可


    转载分享请注明原文地址(追梦者的IT技术博客):http://it.zhuimengba.com/post-8.html

相关文章