{"id":551961,"date":"2022-01-26T20:58:31","date_gmt":"2022-01-26T12:58:31","guid":{"rendered":"http:\/\/4563.org\/?p=551961"},"modified":"2022-01-26T20:58:31","modified_gmt":"2022-01-26T12:58:31","slug":"ssh-key-%e4%b8%80%e6%a8%a1%e4%b8%80%e6%a0%b7%e7%9a%84%e8%ae%be%e7%bd%ae%ef%bc%8c%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%b0%b1%e4%b8%8d%e8%83%bd-%e7%99%bb%e5%bd%95%e6%98%af%e4%bb%80%e4%b9%88%e5%8e%9f%e5%9b%a0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=551961","title":{"rendered":"ssh key \u4e00\u6a21\u4e00\u6837\u7684\u8bbe\u7f6e\uff0c\u53e6\u4e00\u4e2a\u5c31\u4e0d\u80fd \u767b\u5f55\u662f\u4ec0\u4e48\u539f\u56e0\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1> ssh key \u4e00\u6a21\u4e00\u6837\u7684\u8bbe\u7f6e\uff0c\u53e6\u4e00\u4e2a\u5c31\u4e0d\u80fd \u767b\u5f55\u662f\u4ec0\u4e48\u539f\u56e0\uff1f <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <span><i><\/i> 24<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8981\u7528 user1 \u7528\u6237 ssh \u767b\u5f55\u4e24\u53f0\u670d\u52a1\u5668\u3002 <\/p>\n<p>\u4e24\u4e2a\u670d\u52a1\u5668\uff0c\u62f7\u8d1d\u4e86\u76f8\u540c\u7684\u516c\u94a5\uff1a<br \/> \/home\/user1\/.ssh\/id_rsa.pub<br \/> \u548c \/home\/user1\/.ssh\/authorized_keys \uff08 id_rsa.pub \u62f7\u8fdb\u6765\u7684\uff09<br \/> \u4e24\u4e2a\u6587\u4ef6\u7684\u6743\u9650\u90fd\u662f 700 <\/p>\n<p>\/home\/user1 \u6587\u4ef6\u5939\u7684\u6743\u9650\u662f 600 <\/p>\n<p>id_rsa.pub \u3001authorized_keys \u3001\/home\/user1 \u7684\u6240\u5c5e\u7528\u6237\u548c\u6240\u5c5e\u7ec4\u90fd\u662f user1 <\/p>\n<p>\/etc\/ssh\/sshd_config \u8bbe\u7f6e\u7684\u4e5f\u662f\u4e00\u6a21\u4e00\u6837\u7684\uff0c \u4e5f\u91cd\u65b0\u542f\u52a8\u4e86 sshd service \u3002 <\/p>\n<p>\u4e3a\u4ec0\u4e48\u4e00\u53f0\u53ef\u4ee5\u767b\u5f55\uff0c\u4e00\u53f0\u5c31\u767b\u5f55\u4e0d\u4e86\u5462\uff1f<br \/> \u63d0\u793a\u8fd9\u4e2a\u9519\u8bef\uff1a<\/p>\n<pre><code>Permission denied (publickey). <\/code><\/pre>\n<p>\u6bcf\u6b21\u90fd\u88ab\u8fd9\u79cd\u4e1c\u897f\u5361\u4f4f\u4e86\uff0c <\/p>\n<p>\/etc\/ssh\/sshd_config \u914d\u7f6e\u90fd\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<pre><code># Package generated configuration file # See the sshd_config(5) manpage for details  # What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces\/protocols sshd will bind to #ListenAddress :: #ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey \/etc\/ssh\/ssh_host_rsa_key HostKey \/etc\/ssh\/ssh_host_dsa_key HostKey \/etc\/ssh\/ssh_host_ecdsa_key HostKey \/etc\/ssh\/ssh_host_ed25519_key #Privilege Separation is turned on for security UsePrivilegeSeparation no  # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 1024  # Logging SyslogFacility AUTH LogLevel INFO  # Authentication: LoginGraceTime 120 PermitRootLogin no StrictModes yes  RSAAuthentication yes PubkeyAuthentication yes #AuthorizedKeysFile     %h\/.ssh\/authorized_keys  # Don't read the user's ~\/.rhosts and ~\/.shosts files IgnoreRhosts yes # For this to work you will also need host keys in \/etc\/ssh_known_hosts RhostsRSAAuthentication no # similar for protocol version 2 HostbasedAuthentication no # Uncomment if you don't trust ~\/.ssh\/known_hosts for RhostsRSAAuthentication #IgnoreUserKnownHosts yes  # To enable empty passwords, change to yes (NOT RECOMMENDED) PermitEmptyPasswords no  # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no  # Change to no to disable tunnelled clear text passwords PasswordAuthentication no  # Kerberos options #KerberosAuthentication no #KerberosGetAFSToken no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes  # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes  X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no  #MaxStartups 10:30:60 #Banner \/etc\/issue.net  # Allow client to pass locale environment variables AcceptEnv LANG LC_*  Subsystem sftp \/usr\/lib\/openssh\/sftp-server  # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication.  Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of \"PermitRootLogin yes # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM no                                                                                   <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>27<\/span>) <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"7191925\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaowei0823 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> ssh -vvv \u770b\u4e00\u770b\u5462 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191926\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Osk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u770b\u670d\u52a1\u7aef\u7684 sshd \u65e5\u5fd7. \u91cc\u9762\u4e5f\u8bb8\u6709\u66f4\u6709\u7528\u7684\u4fe1\u606f. <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191927\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @Osk ubuntu \u7684 sshd \u65e5\u5fd7 \u662f lastb \u561b\uff1f\uff08\u662f\u4e00\u4e2a ubuntu \u7684 docker \u5bb9\u5668\uff0c\u4f1a\u4e0d\u4f1a\u88ab\u7cbe\u7b80\u4e86\u5c31\u6ca1\u6709\u65e5\u5fd7\u4e86\uff09<br \/>\u800c\u4e14 lastb \u547d\u4ee4\u63d0\u793a \u6ca1\u6709 \/var\/log\/btmp \u6587\u4ef6\u3002 \uff08\u5c31\u662f\u56e0\u4e3a\u8fd9\u4e2a\u6587\u4ef6\u6211\u624d\u8981\u8bbe\u7f6e ssh \u5bc6\u94a5\u767b\u5f55\u7684\uff0c\u4e00\u76f4\u88ab\u66b4\u529b\u7834\u89e3\uff0c\u4e00\u4e2a\u670d\u52a1\u5668\u4e0a\u5927\u6982\u6709\u5341\u51e0\u4e2a ubuntu \u5bb9\u5668\uff0c\u6bcf\u4e2a\u5bb9\u5668\u7684 btmp \u6587\u4ef6 \u90fd\u6709 2 \uff5e 4G \uff01\uff09<br \/>@xiaowei0823 ssh -v \u662f version \u561b\uff0c \u6ca1\u6709\u8fd9\u4e2a option \u63d0\u793a <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191928\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaowei0823 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4f7f\u7528 ssh -vvv \u767b\u5f55\u670d\u52a1\u5668\u7684\u65f6\u5019\u4f1a\u6253\u5370\u8be6\u7ec6\u65e5\u5fd7\uff0c\u4f60\u4e24\u8fb9\u5bf9\u6bd4\u4e00\u4e0b\u770b\u770b\u65e0\u6cd5\u767b\u5f55\u7684\u90a3\u53f0\u670d\u52a1\u5668\u5361\u5728\u54ea\u91cc\u4e86\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191929\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ynyounuo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @selfcreditgiving <br \/>-v <br \/>Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.<br \/>\u770b\u770b -vvv \u5e94\u8be5\u80fd\u5f88\u5feb\u6392\u67e5\u51fa\u6765 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191930\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @xiaowei0823 @ynyounuo \u591a\u8c22 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191931\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Osk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u5982\u679c\u662f\u5bb9\u5668, \u65e5\u5fd7\u5927\u6982\u4e0d\u4f1a\u662f journalctl \u6765\u770b.<br \/>\u5c1d\u8bd5 grep -r sshd \/var\/log <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191932\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u670d\u52a1\u5668 B \uff08\u5931\u8d25\uff09 <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2022\/02\/20220201_61f97af0e789f.png\" rel=\"noreferrer\" alt=\"ssh key \u4e00\u6a21\u4e00\u6837\u7684\u8bbe\u7f6e\uff0c\u53e6\u4e00\u4e2a\u5c31\u4e0d\u80fd \u767b\u5f55\u662f\u4ec0\u4e48\u539f\u56e0\uff1f\"><br \/>\u670d\u52a1\u5668 A \uff08\u6210\u529f\uff09 <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2022\/02\/20220201_61f97afc99ced.jpg\" rel=\"noreferrer\" alt=\"ssh key \u4e00\u6a21\u4e00\u6837\u7684\u8bbe\u7f6e\uff0c\u53e6\u4e00\u4e2a\u5c31\u4e0d\u80fd \u767b\u5f55\u662f\u4ec0\u4e48\u539f\u56e0\uff1f\"><br \/>@xiaowei0823 @ynyounuo \u8bf7\u95ee\u670d\u52a1\u5668 B \u4e3a\u4ec0\u4e48\u4f1a\u627e\u4e0d\u5230 rsa \u7684 key \u5462 \uff0c\u8981\u53bb\u627e\u4ec0\u4e48 dsa_key \uff0c\u90fd\u662f\u5728\u6211\u540c\u4e00\u4e2a\u7b14\u8bb0\u672c\u4e0a\u64cd\u4f5c\u7684 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191933\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u5341\u51e0\u4e2a\u5bb9\u5668\uff0c\u52a0\u8d77\u6765 login fail \u65e5\u5fd7\u6709 40G \u4e86\uff0c\u4e91\u76d8\u672c\u6765\u4e5f\u5c31 100G \u3002 \u771f\u6ca1\u60f3\u5230\u8fd8\u6709\u8fd9\u4e48\u591a\u7684\u673a\u5668\u4eba\u6765\u626b\u63cf <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191934\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Osk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u8d77\u6765\u662f\u670d\u52a1\u7aef\u62d2\u7edd\u4e86 rsa \u7684\u90a3\u4e2a\u516c\u94a5, \u6240\u4ee5 ssh \u5ba2\u6237\u7aef\u8fd9\u8fb9\u4f1a\u7ee7\u7eed\u5c1d\u8bd5 dsa, ecdsa ed25519 \u8fd9\u51e0\u4e2a key \u80fd\u5426\u767b\u5f55, \u4f46\u90a3\u51e0\u4e2a key \u90fd\u4e0d\u5b58\u5728.<br \/>\u800c\u62d2\u7edd\u7684\u539f\u56e0\u9700\u8981\u770b b \u670d\u52a1\u5668\u7684 sshd \u65e5\u5fd7.<br \/>\u53e6\u5916, \u7528\u516c\u94a5\u767b\u5f55\u8fd8\u662f\u4e0d\u80fd\u5f7b\u5e95\u675c\u7edd\u626b\u63cf, \u6bcf\u6b21\u5c1d\u8bd5\u8fd8\u662f\u6709\u65e5\u5fd7\u7684\u5427, \u8981\u914d\u5408 faild2ban, sshguard \u7b49\u624d\u80fd\u6321\u4e00\u4e0b. <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191935\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dingwen07 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u770b openssh \u7248\u672c\uff1f\u4e00\u822c\u6765\u8bf4\u80fd\u5230\u8fd9\u4e5f\u4e0d\u4f1a\u6709\u95ee\u9898<br \/>\u8fd8\u5f97\u770b\u670d\u52a1\u5668\u4e0a\u7684\u65e5\u5fd7 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191936\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : HXM <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u53ef\u4ee5\u5c1d\u8bd5\u6682\u65f6\u6027\u7684\u628a sshd_config \u91cc StrictModes \u4ece yes \u6539\u6210 no \u770b\u770b\u80fd\u4e0d\u80fd\u767b\u5f55\uff0c\u5982\u679c\u8fd9\u6837\u53ef\u4ee5\u767b\u5f55\u7684\u8bdd\u90a3\u5c31\u662f\u6587\u4ef6\u6743\u9650\u95ee\u9898<br \/>\u53c2\u8003\u6765\u6e90 https:\/\/web.archive.org\/web\/20140327182105\/http:\/\/www.openssh.org\/faq.html#3.14 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191937\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ynyounuo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4f30\u8ba1\u8fd8\u662f\u4f60 server B \u4e0a .ssh\/ \u7684\u6587\u4ef6\u5939\u6743\u9650\u95ee\u9898\uff0c\u770b\u770b\u662f\u4e0d\u662f 700 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191938\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @HXM @dingwen07 @ynyounuo \u597d\u7684\uff0c\u6211\u660e\u5929\u518d\u8bd5\u4e0b\u770b\u770b\u3002<br \/>@Osk \u516c\u94a5\u8fd8\u662f\u4f1a\u7206\u65e5\u5fd7\u561b\uff0clinux \u5f00\u6e90\u4e16\u754c\u80fd\u4e0d\u80fd\u5bf9\u7a0b\u5e8f\u5458\u7b80\u5355\uff0c\u53cb\u597d\u4e00\u70b9\u5462\uff0c\uff0c\uff0c \u6765\u4e2a\u5f00\u7bb1\u5373\u7528\u7684\u591a\u597d\u554a\u3002<br \/>\u4e0d\u662f\u4e13\u95e8\u7684\u8fd0\u7ef4\uff0c\u6709\u6ca1\u6709\u6700\u5c11\u914d\u7f6e\u7684\u6700\u4f73\u5b9e\u8df5\u5462\u3002 \u5982\u679c\u8bf4\u88c5 vpn \u80fd\u4e0d\u80fd\u675c\u7edd\u8fd9\u79cd\u60c5\u51b5\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191939\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Osk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @selfcreditgiving \u516c\u94a5\u53ea\u662f\u907f\u514d\u522b\u4eba\u66b4\u529b\u8bd5\u51fa\u5bc6\u7801, \u4f46\u5b83\u8fdb\u884c\u4e2d\u7684\u5c1d\u8bd5\u4ecd\u7136\u4f1a\u7ee7\u7eed, \u6bcf\u6b21\u5c1d\u8bd5\u90fd\u4f1a\u8bb0\u5f55 sshd \u65e5\u5fd7, \u65e5\u5fd7\u4ecd\u7136\u4f1a\u6da8.<br \/>ssh \u7684\u90e8\u5206\u5efa\u8bae:<br \/>\u4e0d\u8981\u7528\u9ed8\u8ba4\u7684 22 \u7aef\u53e3, \u51cf\u5c11\u4e00\u4e9b\u6279\u91cf\u811a\u672c\u5de5\u5177\u6709\u4e8b\u6ca1\u4e8b\u7684\u626b\u63cf.<br \/>\u4e0d\u8981\u4f7f\u7528\u5bc6\u7801\u767b\u5f55, \u800c\u662f\u4f7f\u7528\u516c\u94a5\u6216\u8005\u4e24\u6b65\u8ba4\u8bc1\u767b\u5f55, \u907f\u514d\u88ab\u8bd5\u51fa\u5bc6\u7801\u8fdb\u5165.<br \/>\u7981\u6b62 root \u7528\u6237\u767b\u5f55.<br \/>\u9650\u5236 sshd \u8fde\u63a5\u6570, \u4f46\u6709\u628a\u81ea\u5df1\u9501\u5230\u5916\u8fb9\u65e0\u6cd5\u767b\u5f55\u7684\u98ce\u9669.<br \/>\u4f7f\u7528 sshguard, fail2ban \u6216\u8005\u7aef\u53e3\u6572\u95e8\u7b49\u529e\u6cd5\u51cf\u5c11\u88ab\u626b\u63cf\u7684\u6b21\u6570.<br \/>\u53e6\u5916, \u5efa\u8bae\u4f7f\u7528\u8df3\u677f\u673a\u7ba1\u7406\u4f60\u7684\u670d\u52a1\u5668: \u8fd9\u6837\u7684\u8bdd, \u653b\u51fb\u8005\u9996\u5148\u8981\u7834\u89e3\u4e86\u8df3\u677f\u673a\u7684\u767b\u5f55\u624d\u53ef\u4ee5\u8fdb\u884c\u540e\u7eed\u7684\u626b\u63cf, \u5927\u5927\u964d\u4f4e\u4e86\u5176\u5b83\u751f\u4ea7\u670d\u52a1\u5668\u88ab ssh \u66b4\u529b\u653b\u51fb\u7684\u6b21\u6570, \u8df3\u677f\u673a\u7684 sshd \u65e5\u5fd7\u6da8\u5c31\u8ba9\u5b83\u6da8\u5427, \u53cd\u6b63\u751f\u4ea7\u670d\u52a1\u5668\u4e0d\u6da8\u5c31\u884c.<br \/>\u5f53\u7136, \u4f7f\u7528 vpn \u6765\u4fdd\u62a4\u4e5f\u662f\u4e0d\u9519\u7684\u65b9\u6848, \u4e0d\u8fc7\u6211\u89c9\u5f97 vpn \u53ef\u80fd\u4e5f\u6709\u88ab\u626b\u63cf\u7684\u95ee\u9898, \u4e0d\u5982\u628a sshd \u7684\u5b89\u5168\u505a\u597d.<br \/>\u81f3\u4e8e\u5982\u4f55\u505a, \u786e\u5b9e\u6ca1\u6709\u5f88\u7edf\u4e00\u7684\u505a\u6cd5, linux \u53d1\u884c\u7248\u95f4\u788e\u7247\u5316\u592a\u4e25\u91cd\u4e86, \u53ea\u80fd\u6839\u636e\u4f60\u5f53\u524d\u7684\u53d1\u578b\u7248\u53bb\u770b\u5b98\u65b9\u7684 wiki \u6216\u8005\u624b\u518c.<br \/>\u53e6\u5916, windows rdp 3389 \u66f4\u4e0d\u597d\u641e, \u4e24\u90e8\u8ba4\u8bc1, \u8bc1\u4e66\u767b\u5f55\u4ec0\u4e48\u7684, \u90fd\u76f8\u5f53\u4e0d\u5bb9\u6613\u914d\u7f6e, \u6bd4 ssh \u914d\u7f6e\u9ebb\u70e6\u591a\u4e86. <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191940\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : EIlenZe <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @Osk \u6bcf\u6b21\u770b\u5230\u8fd9\u4e9b\u5c31\u4f1a\u60f3 \u8981\u662f\u4e16\u754c\u4e0a\u6ca1\u6709\u6000\u6709\u6076\u610f\u7684\u4eba \u662f\u4e0d\u662f\u5c31\u53ef\u4ee5\u4e0d\u7528\u505a\u90a3\u4e48\u591a\u5de5\u4f5c\u4e86\u2026 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191941\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : laucenmi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> osx \u5347\u7ea7 openssh \u540e\u9047\u5230\u8fc7\u67d0\u4e9b\u670d\u52a1\u5668\u4e0d\u80fd\u767b\u5f55\u7684\u95ee\u9898, \u5728.ssh\/config \u5bf9 host \u6dfb\u52a0\u4e86<br \/> HostKeyAlgorithms +ssh-rsa<br \/> PubkeyAcceptedKeyTypes +ssh-rsa<br \/>\u624d\u53ef\u4ee5\u5de5\u4f5c. <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191942\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div>  @Osk \u591a\u8c22\u8bf4\u7684\u592a\u8be6\u7ec6\u4e86\uff01<br \/> \u8fd8\u6709\u90fd\u914d\u597d\u540e\uff0c\u7528\u4e00\u4e2a\u975e root \u8d26\u6237\uff0c\u6bcf\u6b21 sudo \u8981\u8f93\u5bc6\u7801\uff0c\u540c\u65f6\u547d\u4ee4\u524d\u53c8\u8981\u52a0\u4e2a sudo \uff0c\u6572\u8d77\u547d\u4ee4\u6765\u597d\u7d2f\u554a <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191943\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : acmore <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @EIlenZe \u90a3\u4e48\u4e16\u754c\u4e0a\u4e5f\u4f1a\u5931\u53bb\u5f88\u591a\u5de5\u4f5c\u5c97\u4f4d\uff08\u72d7\u5934 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191944\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dddd1919 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u5144\u5f1f\uff0c\u4f60\u79c1\u94a5\u5462\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191945\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shangyu7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u770b ssh \u7248\u672c <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191946\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pixelcn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4e00\u53f0\u662f RPM \u7cfb\u7684\u5427\uff1f\u6709 bug<br \/>PubkeyAcceptedKeyTypes \u52a0\u4e0a rsa-sha2-512,rsa-sha2-256 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191947\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ziseyinzi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u5e94\u8be5\u662f 17 \u8bf4\u7684\uff0copenssh \u7248\u672c\u95ee\u9898\u3002\u65b0\u7248\u672c openssh \u56e0\u4e3a\u5b89\u5168\u539f\u56e0\u4f1a\u62d2\u7edd rsa \u7b97\u6cd5\u7684 key \u3002\u5347\u7ea7\u670d\u52a1\u7aef\u7684 openssh \u7248\u672c\u6216\u8005\u5728\u672c\u5730\u50cf 17 \u8bf4\u7684\u90a3\u6837\u6dfb\u52a0\u5141\u8bb8\u89c4\u5219\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191948\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysn2233 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u9ad8\u7248\u672c\u7684 openssh \u52a0\u5bc6\u7b97\u6cd5\u6362\u4e86\uff0c\u8981\u914d\u7f6e\u4e00\u4e0b <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191949\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u62b1\u6b49\uff0c\u4e4b\u524d\u6709\u4e8b\u60c5\u73b0\u5728\u624d\u66f4\u65b0\u3002<br \/>\u8fd9\u4e24\u53f0\u670d\u52a1\u5668 \u662f\u8fd9\u6837\u7684\uff0c\u90fd\u662f\u7528 docker \u8d77\u7684 ubuntu \u955c\u50cf\u5bb9\u5668\uff0c\u800c\u4e14\u955c\u50cf\u662f\u4e00\u6a21\u4e00\u6837\u7684\u3002\u5f00\u653e\u51fa\u4e86 ssh \u7aef\u53e3\u3002<br \/>\u8fd9\u662f\u4e24\u53f0\u670d\u52a1\u5668\u7684 openSSH \u7248\u672c ssh -V <br \/>\u670d\u52a1\u5668 A \u548c \u670d\u52a1\u5668 B \u7684\u7ed3\u679c\u90fd\u662f\u4e00\u6837\u7684\uff1a<br \/>OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g 1 Mar 2016<br \/>\u672c\u8eab\u64cd\u4f5c\u7528\u7684 macbook pro \u7684 ssh \u7248\u672c\uff1a<br \/>OpenSSH_7.4p1, LibreSSL 2.5.0<br \/>\/etc\/ssh\/sshd_config \u4e24\u53f0\u670d\u52a1\u5668\u4e5f\u662f\u4e00\u6a21\u4e00\u6837\u7684\u3002<br \/>@pixelcn @ziseyinzi @ysn2233 \u5728\u767b\u5f55\u5931\u8d25\u7684 \u670d\u52a1\u5668 B \u8bbe\u7f6e\u4e86 \/etc\/ssh\/sshd_config \uff0c\u6dfb\u52a0 PubkeyAcceptedKeyTypes rsa-sha2-512,rsa-sha2-256 \uff0c\u5e76\u91cd\u542f\u5bb9\u5668\uff08\u56e0\u4e3a docker \u5bb9\u5668\u91cc\u4e0d\u80fd \u7528 service restart \uff09<br \/>\u7ed3\u679c\u8fd8\u662f\u4e00\u6837\u7684\u3002<br \/>\u611f\u89c9\u6211\u8fd8\u662f\u8bbe\u4e00\u4e2a\u5f3a\u5bc6\u7801\uff0c\u7136\u540e\u8bbe\u4e00\u4e2a fail2ban \uff0c\u53ef\u4e0d\u77e5\u9053 fail2ban \u6709\u6ca1\u6709\u4ec0\u4e48\u5751\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u597d\u5c31\u4e0d\u7528\u7ba1\u4e86\u4e0d\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191950\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @Osk <br \/>@dddd1919 <br \/>@shangyu7 <br \/>@pixelcn <br \/>@ziseyinzi <br \/>@ysn2233 \u53d1\u73b0\u539f\u56e0\u4e86\uff0c\u53c8\u662f\u81ea\u5df1\u7684\u7c97\u5fc3\u5927\u610f\u6d6a\u8d39\u4e86\u5927\u91cf\u7684\u65f6\u95f4\u3002<br \/>\u5e94\u8be5\u662f ~\/.ssh \u8bbe\u7f6e\u4e3a\u6743\u9650 700 <br \/> ~\/.ssh\/authorized_keys \u8bbe\u7f6e\u4e3a 600<br \/>\u6211\u8bbe\u7f6e\u53cd\u4e86\uff01 \u60f3\u5f53\u7136 ~\/.ssh\/authorized_keys \u662f\u6587\u4ef6\u9700\u8981 \u6267\u884c\u6743\u9650\uff0c ~\/.ssh \u662f\u6587\u4ef6\u5939 \u53ea\u8981 \u8bfb\u5199\u6743\u9650\u5c31\u884c\u4e86\u3002<br \/>\u540e\u9762\u641c\u5230\u624d\u53d1\u73b0\u5f04\u53cd\u4e86\u3002 <br \/>server A \uff08\u6210\u529f\uff09\u662f\u56e0\u4e3a \uff0c \u6ca1\u6709\u624b\u52a8\u53bb\u6539 chomd \u6743\u9650\uff0c ~\/.ssh\/authorized_keys \u9ed8\u8ba4\u662f 644 \u7684\u6743\u9650\u3002<br \/>\u7ecf\u5e38\u4f1a\u8fd9\u6837\u81ea\u5df1\u641e\u6b7b\u81ea\u5df1\uff0c\u6d6a\u8d39\u5927\u91cf\u7684\u65f6\u95f4\u3001\u71ac\u591c\uff0c\u56e0\u4e3a\u90a3\u4e00\u5757\u662f\u786e\u8ba4\u8fc7\u4e86\u7684\uff0c\u8ba4\u4e3a\u90a3\u91cc\u80af\u5b9a\u662f\u6ca1\u6709\u95ee\u9898\u7684\uff0c\u5c31\u6ca1\u60f3\u5230\u518d\u53bb\u786e\u8ba4\u4e00\u6b21\u3002\u5927\u5bb6\u6709\u6ca1\u6709\u540c\u6837\u7684\u7ecf\u5386\uff1f\u6216\u8005\u5982\u679c\u89c4\u907f\u81ea\u5df1\u7684\u4f4e\u7ea7\u9519\u8bef\u5bfc\u81f4\u5361\u58f3\u7684\u60c5\u51b5\uff1f <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7191951\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : selfcreditgiving <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u76ee\u524d\u627e\u5230\u4e00\u4e2a \u4fbf\u5229 \u548c \u5b89\u5168 \u4e4b\u95f4\u76f8\u5bf9\u6298\u4e2d\u7684\u65b9\u6cd5\uff0c \u5c31\u662f\uff1a\u6240\u6709\u7684\u670d\u52a1\u5668\u90fd\u7528\u540c\u4e00\u4e2a ssh \u79c1\u94a5\u3002ssh \u79c1\u94a5\u8bbe\u7f6e passphrase \uff0c\u5e76\u4e14 passphrase \u4fdd\u5b58\u5230 macOS \u7684 keychain \uff08\u4f7f\u7528 ssh-add -K keyfile \uff09 <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>ssh key \u4e00\u6a21\u4e00\u6837\u7684\u8bbe\u7f6e\uff0c\u53e6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/551961"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=551961"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/551961\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=551961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=551961"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=551961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}