{"id":136,"date":"2009-10-26T16:27:11","date_gmt":"2009-10-26T16:27:11","guid":{"rendered":"http:\/\/kumouse.aafox.com\/?p=136"},"modified":"2009-10-26T16:27:11","modified_gmt":"2009-10-26T16:27:11","slug":"ssh-%e9%85%8d%e7%bd%ae-ssh_config-sshd_config","status":"publish","type":"post","link":"https:\/\/www.kumouse.com\/?p=136","title":{"rendered":"ssh \u914d\u7f6e ssh_config sshd_config"},"content":{"rendered":"<p>ssh_config<\/p>\n<blockquote><p># Host *&nbsp;&nbsp;(\u53ea\u5bf9\u80fd\u591f\u5339\u914d\u540e\u9762\u5b57\u4e32\u7684\u8ba1\u7b97\u673a\u6709\u6548\u3002\u201c*\u201d\u8868\u793a\u6240\u6709\u7684\u8ba1\u7b97\u673a)<br \/>#   ForwardAgent no&nbsp;&nbsp;(\u8bbe\u7f6e\u8fde\u63a5\u662f\u5426\u7ecf\u8fc7\u9a8c\u8bc1\u4ee3\u7406\uff08\u5982\u679c\u5b58\u5728\uff09\u8f6c\u53d1\u7ed9\u8fdc\u7a0b\u8ba1\u7b97\u673a)<br \/>#   ForwardX11 no&nbsp;&nbsp;(\u8bbe\u7f6eX11\u8fde\u63a5\u662f\u5426\u88ab\u81ea\u52a8\u91cd\u5b9a\u5411\u5230\u5b89\u5168\u7684\u901a\u9053\u548c\u663e\u793a\u96c6)<br \/>#   RhostsRSAAuthentication no&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u4f7f\u7528\u7528RSA\u7b97\u6cd5\u7684\u57fa\u4e8erhosts\u7684\u5b89\u5168\u9a8c\u8bc1)<br \/>#   RSAAuthentication yes&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u4f7f\u7528RSA\u7b97\u6cd5\u8fdb\u884c\u5b89\u5168\u9a8c\u8bc1)<br \/>#   PasswordAuthentication yes&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u4f7f\u7528\u53e3\u4ee4\u9a8c\u8bc1)<br \/>#   HostbasedAuthentication no&nbsp;&nbsp;(\u82e5\u8bbe\u7f6e\u4e3ayes\uff0c\u5219\u5c1d\u8bd5\u7740\u8fdb\u884crhosts\u8eab\u4efd\u9a8c\u8bc1\u3002\u5bf9\u4e8e\u5b89\u5168\u8981\u6c42\u66f4\u9ad8\u7684\u7cfb\u7edf\uff0c\u8bf7\u5c06\u5176\u8bbe\u7f6e\u4e3ano\uff08\u9ed8\u8ba4\u503c\uff09)<br \/>#   GSSAPIAuthentication no&nbsp;&nbsp;(ssh\u7684\u4f1a\u8bdd\u76f4\u5230DNS\u8bf7\u6c42\u8d85\u65f6\u624d\u4f1a\u7ee7\u7eed\u4e0b\u53bb,\u5efa\u610fno)<br \/>#   GSSAPIDelegateCredentials no&nbsp;&nbsp;(ssh\u7684\u4f1a\u8bdd\u76f4\u5230DNS\u8bf7\u6c42\u8d85\u65f6\u624d\u4f1a\u7ee7\u7eed\u4e0b\u53bb,\u5efa\u610fno)<br \/>#   BatchMode no&nbsp;&nbsp;(\u5982\u679c\u8bbe\u4e3a\u201cyes\u201d\uff0cpassphrase\/password\uff08\u4ea4\u4e92\u5f0f\u8f93\u5165\u53e3\u4ee4\uff09\u7684\u63d0\u793a\u5c06\u88ab\u7981\u6b62\u3002<br \/>\u5f53\u4e0d\u80fd\u4ea4\u4e92\u5f0f\u8f93\u5165\u53e3\u4ee4\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u9009\u9879\u5bf9\u811a\u672c\u6587\u4ef6\u548c\u6279\u5904\u7406\u4efb\u52a1\u5341\u5206\u6709\u7528)<br \/>#   CheckHostIP yes&nbsp;&nbsp;(\u8bbe\u7f6essh\u662f\u5426\u67e5\u770b\u8fde\u63a5\u5230\u670d\u52a1\u5668\u7684\u4e3b\u673a\u7684IP\u5730\u5740\u4ee5\u9632\u6b62DNS\u6b3a\u9a97\u3002\u5efa\u8bae\u8bbe\u7f6e\u4e3a\u201cyes\u201d)<br \/>#   AddressFamily any&nbsp;&nbsp;(\u8bbe\u7f6e\u5141\u8bb8\u7684\u5730\u5740)<br \/>#   ConnectTimeout 0&nbsp;&nbsp;(\u8fde\u63a5\u8d85\u65f6)<br \/>#   StrictHostKeyChecking ask&nbsp;&nbsp;(\u5982\u679c\u8bbe\u7f6e\u6210\u201cyes\u201d\uff0cssh\u5c31\u4e0d\u4f1a\u81ea\u52a8\u628a\u8ba1\u7b97\u673a\u7684\u5bc6\u5319\u52a0\u5165\u201c$HOME\/.ssh)<br \/>#   IdentityFile ~\/.ssh\/identity&nbsp;&nbsp;(\u8bbe\u7f6e\u4ece\u54ea\u4e2a\u6587\u4ef6\u8bfb\u53d6\u7528\u6237\u7684RSA\u5b89\u5168\u9a8c\u8bc1\u6807\u8bc6)<br \/>#   IdentityFile ~\/.ssh\/id_rsa<br \/>#   IdentityFile ~\/.ssh\/id_dsa<br \/>#   Port 22&nbsp;&nbsp;(\u8bbe\u7f6e\u8fde\u63a5\u5230\u8fdc\u7a0b\u4e3b\u673a\u7684\u7aef\u53e3)<br \/>#   Protocol 2,1&nbsp;&nbsp;(\u8bbe\u7f6e\u534f\u8bae\u7248\u672c\uff0c\u5efa\u610f\u75282)<br \/>#   Cipher 3des&nbsp;&nbsp;(\u8bbe\u7f6e\u52a0\u5bc6\u7528\u7684\u5bc6\u7801)<br \/>#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc<br \/>#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160<br \/>#   EscapeChar ~&nbsp;&nbsp;(\u8bbe\u7f6eescape\u5b57\u7b26)<br \/>#   Tunnel no&nbsp;&nbsp;(\u96a7\u9053\u6a21\u5f0f)<br \/>#   TunnelDevice any:any<br \/>#   PermitLocalCommand no<br \/>#   VisualHostKey no<\/p><\/blockquote>\n<p>=======================================================<\/p>\n<p>sshd_config<\/p>\n<blockquote><p>#Port 22&nbsp;&nbsp;(\u8bbe\u7f6esshd\u76d1\u542c\u7684\u7aef\u53e3\u53f7)<br \/>#AddressFamily any<br \/>#ListenAddress 0.0.0.0&nbsp;&nbsp;(\u8bbe\u7f6esshd\u670d\u52a1\u5668\u7ed1\u5b9a\u7684IP\u5730\u5740)<br \/>#ListenAddress ::<\/p>\n<p>Protocol 2&nbsp;&nbsp;(\u8bbe\u7f6e\u534f\u8bae\u7248\u672c)<\/p>\n<p># HostKey for protocol version 1<br \/>#HostKey \/etc\/ssh\/ssh_host_key&nbsp;&nbsp;(\u8bbe\u7f6e\u5305\u542b\u8ba1\u7b97\u673a\u79c1\u4eba\u5bc6\u5319\u7684\u6587\u4ef6)<br \/># HostKeys for protocol version 2<br \/>#HostKey \/etc\/ssh\/ssh_host_rsa_key<br \/>#HostKey \/etc\/ssh\/ssh_host_dsa_key<\/p>\n<p># Lifetime and size of ephemeral version 1 server key<br \/>#KeyRegenerationInterval 1h&nbsp;&nbsp;(KeyRegenerationInterval\u30003600)<br \/>#ServerKeyBits 1024&nbsp;&nbsp;(\u5b9a\u4e49\u670d\u52a1\u5668\u5bc6\u5319\u7684\u4f4d\u6570)<\/p>\n<p># Logging<br \/># obsoletes QuietMode and FascistLogging<br \/>#SyslogFacility AUTH&nbsp;&nbsp;(\u8bbe\u7f6e\u5728\u8bb0\u5f55\u6765\u81easshd\u7684\u6d88\u606f\u7684\u65f6\u5019\uff0c\u662f\u5426\u7ed9\u51fa\u201cfacility\u3000code\u201d)<br \/>SyslogFacility AUTHPRIV<br \/>#LogLevel INFO&nbsp;&nbsp;(\u8bbe\u7f6e\u8bb0\u5f55sshd\u65e5\u5fd7\u6d88\u606f\u7684\u5c42\u6b21\u3002INFO\u662f\u4e00\u4e2a\u597d\u7684\u9009\u62e9\u3002\u67e5\u770bsshd\u7684man\u5e2e<br \/>\u52a9\u9875\uff0c\u5df2\u83b7\u53d6\u66f4\u591a\u7684\u4fe1\u606f)<\/p>\n<p># Authentication:<\/p>\n<p>#LoginGraceTime 2m&nbsp;&nbsp;(\u8bbe\u7f6e\u5982\u679c\u7528\u6237\u4e0d\u80fd\u6210\u529f\u767b\u5f55\uff0c\u5728\u5207\u65ad\u8fde\u63a5\u4e4b\u524d\u670d\u52a1\u5668\u9700\u8981\u7b49\u5f85\u7684\u65f6\u95f4)<br \/>#PermitRootLogin yes&nbsp;&nbsp;(\u8bbe\u7f6eroot\u80fd\u4e0d\u80fd\u7528ssh\u767b\u5f55\u3002\u8fd9\u4e2a\u9009\u9879\u4e00\u5b9a\u4e0d\u8981\u8bbe\u6210\u201cyes\u201d)<br \/>#StrictModes yes (\u8bbe\u7f6essh\u5728\u63a5\u6536\u767b\u5f55\u8bf7\u6c42\u4e4b\u524d\u662f\u5426\u68c0\u67e5\u7528\u6237\u5bb6\u76ee\u5f55\u548crhosts\u6587\u4ef6\u7684\u6743\u9650\u548c\u6240<br \/>\u6709\u6743\u3002\u8fd9\u901a\u5e38\u662f\u5fc5\u8981\u7684\uff0c\u56e0\u4e3a\u65b0\u624b\u7ecf\u5e38\u4f1a\u628a\u81ea\u5df1\u7684\u76ee\u5f55\u548c\u6587\u4ef6\u8bbe\u6210\u4efb\u4f55\u4eba\u90fd\u6709\u5199\u6743\u9650)<br \/>#MaxAuthTries 6 (\u9650\u5236\u767b\u9646\u5bc6\u7801\u8f93\u9519\u6b21\u6570)<br \/>#MaxSessions 10<\/p>\n<p>#RSAAuthentication yes&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8\u7528rhosts\u6216\u201c\/etc\/hosts.equiv\u201d\u52a0\u4e0aRSA\u8fdb\u884c\u5b89\u5168\u9a8c\u8bc1)<br \/>#PubkeyAuthentication yes<br \/>#AuthorizedKeysFile&nbsp;&nbsp;.ssh\/authorized_keys<\/p>\n<p># For this to work you will also need host keys in \/etc\/ssh\/ssh_known_hosts<br \/>#RhostsRSAAuthentication no&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8\u7528rhosts\u6216\u201c\/etc\/hosts.equiv\u201d\u52a0\u4e0aRSA\u8fdb\u884c\u5b89\u5168\u9a8c\u8bc1)<br \/># similar for protocol version 2<br \/>#HostbasedAuthentication no<br \/># Change to yes if you don&#39;t trust ~\/.ssh\/known_hosts for<br \/># RhostsRSAAuthentication and HostbasedAuthentication<br \/>#IgnoreUserKnownHosts no (\u8bbe\u7f6essh\u3000daemon\u662f\u5426\u5728\u8fdb\u884cRhostsRSAAuthentication\u5b89\u5168\u9a8c\u8bc1<br \/>\u7684\u65f6\u5019\u5ffd\u7565\u7528\u6237\u7684\u201c$HOME\/.ssh\/known_hosts)<br \/># Don&#39;t read the user&#39;s ~\/.rhosts and ~\/.shosts files<br \/>#IgnoreRhosts yes (\u8bbe\u7f6e\u9a8c\u8bc1\u7684\u65f6\u5019\u662f\u5426\u4f7f\u7528\u201crhosts\u201d\u548c\u201cshosts\u201d\u6587\u4ef6)<\/p>\n<p># To disable tunneled clear text passwords, change to no here!<br \/>#PasswordAuthentication yes&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8\u53e3\u4ee4\u9a8c\u8bc1)<br \/>#PermitEmptyPasswords no&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8\u7528\u53e3\u4ee4\u4e3a\u7a7a\u7684\u5e10\u53f7\u767b\u5f55)<br \/>PasswordAuthentication yes<\/p>\n<p># Change to no to disable s\/key passwords<br \/>#ChallengeResponseAuthentication yes<br \/>ChallengeResponseAuthentication no<\/p>\n<p># Kerberos options<br \/>#KerberosAuthentication no<br \/>#KerberosOrLocalPasswd yes<br \/>#KerberosTicketCleanup yes<br \/>#KerberosGetAFSToken no<\/p>\n<p># GSSAPI options<br \/>#GSSAPIAuthentication no<br \/>GSSAPIAuthentication yes<br \/>#GSSAPICleanupCredentials yes<br \/>GSSAPICleanupCredentials yes<\/p>\n<p># Set this to &#39;yes&#39; to enable PAM authentication, account processing, <br \/># and session processing. If this is enabled, PAM authentication will <br \/># be allowed through the ChallengeResponseAuthentication and<br \/># PasswordAuthentication.  Depending on your PAM configuration,<br \/># PAM authentication via ChallengeResponseAuthentication may bypass<br \/># the setting of &quot;PermitRootLogin without-password&quot;.<br \/># If you just want the PAM account and session checks to run without<br \/># PAM authentication, then enable this but set PasswordAuthentication<br \/># and ChallengeResponseAuthentication to &#39;no&#39;.<br \/>#UsePAM no<br \/>UsePAM yes<\/p>\n<p># Accept locale-related environment variables<br \/>AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES<br \/>AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT<br \/>AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE<\/p>\n<p>#AllowAgentForwarding yes<br \/>#AllowTcpForwarding yes<br \/>#GatewayPorts no<br \/>#X11Forwarding no&nbsp;&nbsp;(\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8X11\u8f6c\u53d1)<br \/>X11Forwarding yes<br \/>#X11DisplayOffset 10<br \/>#X11UseLocalhost yes<br \/>#PrintMotd yes&nbsp;&nbsp;(\u8bbe\u7f6esshd\u662f\u5426\u5728\u7528\u6237\u767b\u5f55\u7684\u65f6\u5019\u663e\u793a\u201c\/etc\/motd\u201d\u4e2d\u7684\u4fe1\u606f)<br \/>#PrintLastLog yes<br \/>#TCPKeepAlive yes<br \/>#UseLogin no<br \/>#UsePrivilegeSeparation yes<br \/>#PermitUserEnvironment no<br \/>#Compression delayed<br \/>#ClientAliveInterval 0<br \/>#ClientAliveCountMax 3<br \/>#ShowPatchLevel no<br \/>#UseDNS yes<br \/>#PidFile \/var\/run\/sshd.pid<br \/>#MaxStartups 10 (\u540c\u65f6\u767b\u5f55\u7684\u7528\u6237\u7684\u4e2a\u6570)<br \/>#PermitTunnel no<br \/>#ChrootDirectory none (ChrootDirectory  \/home\/%u\u6539\u53d8\u767b\u9646\u8005\u7684\u76ee\u5f55)<\/p>\n<p># no default banner path<br \/>#Banner none<\/p>\n<p># override default of no subsystems<br \/>Subsystem&nbsp;&nbsp;sftp&nbsp;&nbsp;\/usr\/libexec\/openssh\/sftp-server<\/p>\n<p># Example of overriding settings on a per-user basis<br \/>#Match User anoncvs<br \/>#&nbsp;&nbsp;X11Forwarding no<br \/>#&nbsp;&nbsp;AllowTcpForwarding no<br \/>#&nbsp;&nbsp;ForceCommand cvs server<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>ssh_config # Host *&nbsp;&nbsp;(\u53ea\u5bf9\u80fd\u591f\u5339\u914d\u540e\u9762\u5b57\u4e32\u7684\u8ba1\u7b97\u673a\u6709\u6548\u3002\u201c*\u201d\u8868\u793a\u6240 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=136"}],"version-history":[{"count":0,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}