{"id":86496,"date":"2026-07-28T19:08:56","date_gmt":"2026-07-28T11:08:56","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/86496.html"},"modified":"2026-07-28T19:08:56","modified_gmt":"2026-07-28T11:08:56","slug":"ubuntu%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%85%8d%e5%af%86%e7%99%bb%e5%bd%95%e8%ae%be%e7%bd%ae%e4%b8%8e%e6%b5%8b%e8%af%95%ef%bc%9a%e7%bb%93%e5%90%88ai%e5%b7%a5%e5%85%b7%e7%9a%84%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/86496.html","title":{"rendered":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5"},"content":{"rendered":"<h2>Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5&#xff1a;\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5<\/h2>\n<h3>\u5f15\u8a00<\/h3>\n<p>\u4f5c\u4e3a\u4e00\u540d\u5f00\u53d1\u517c\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u6bcf\u5929\u8981\u767b\u5f55\u81f3\u5c1110\u53f0\u670d\u52a1\u5668\u6267\u884c\u547d\u4ee4\u3001\u90e8\u7f72\u4ee3\u7801\u3001\u67e5\u770b\u65e5\u5fd7\u3002\u4ee5\u524d\u6bcf\u6b21\u767b\u5f55\u90fd\u8981\u8f93\u5165SSH\u5bc6\u7801&#xff0c;\u6267\u884csudo\u547d\u4ee4\u8fd8\u8981\u518d\u8f93\u4e00\u904d\u5bc6\u7801&#xff0c;\u4e00\u5929\u4e0b\u6765\u5149\u662f\u8f93\u5bc6\u7801\u90fd\u8981\u82b1\u4e0d\u5c11\u65f6\u95f4&#xff0c;\u6548\u7387\u4f4e\u5f97\u8ba9\u4eba\u5d29\u6e83\u3002\u8bb0\u5f97\u6709\u4e00\u6b21\u8d76\u9879\u76ee\u4e0a\u7ebf&#xff0c;\u6211\u57281\u5c0f\u65f6\u5185\u767b\u5f55\u4e868\u53f0\u670d\u52a1\u5668&#xff0c;\u8f93\u4e8616\u6b21\u5bc6\u7801&#xff0c;\u6700\u540e\u624b\u6307\u90fd\u9ebb\u6728\u4e86&#xff0c;\u8fd8\u56e0\u4e3a\u8f93\u5165\u9519\u8bef\u5bfc\u81f4\u767b\u5f55\u5931\u8d25&#xff0c;\u5dee\u70b9\u8bef\u4e86\u4e0a\u7ebf\u65f6\u95f4\u3002<\/p>\n<p>\u6700\u8fd1\u6211\u521a\u642d\u5efa\u4e86\u4e00\u53f0Ubuntu 24.04\u6d4b\u8bd5\u673a&#xff0c;\u6253\u7b97\u5f7b\u5e95\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u2014\u2014\u914d\u7f6eSSH\u514d\u5bc6\u767b\u5f55&#043;sudo\u514d\u5bc6\u7801\u3002\u8fc7\u7a0b\u4e2d\u5076\u7136\u7528\u5230\u4e86Trea AI\u8f85\u52a9\u6267\u884c\u547d\u4ee4&#xff0c;\u6ca1\u60f3\u5230\u5927\u5927\u63d0\u9ad8\u4e86\u6548\u7387&#xff0c;\u4e0d\u4ec5\u51cf\u5c11\u4e86\u624b\u52a8\u8f93\u5165\u9519\u8bef&#xff0c;\u8fd8\u5e2e\u6211\u6392\u67e5\u4e86\u51e0\u4e2a\u5173\u952e\u95ee\u9898\u3002\u4eca\u5929\u5c31\u6765\u5206\u4eab\u4e00\u4e0b\u6211\u7684\u771f\u5b9e\u5b9e\u8df5\u7ecf\u9a8c&#xff0c;\u5305\u62ec\u8e29\u8fc7\u7684\u5751\u3001\u89e3\u51b3\u65b9\u6848\u4ee5\u53ca\u591a\u5e74\u6765\u79ef\u7d2f\u7684\u8fd0\u7ef4\u5fc3\u5f97&#xff0c;\u5e0c\u671b\u80fd\u5e2e\u52a9\u65b0\u624b\u5c11\u8d70\u5f2f\u8def\u3002<\/p>\n<h3>\u4e00\u3001\u64cd\u4f5c\u73af\u5883<\/h3>\n<ul>\n<li>\u670d\u52a1\u5668&#xff1a;Ubuntu 24.04&#xff08;\u65b0\u642d\u5efa\u7684\u6d4b\u8bd5\u673a&#xff0c;\u4e3b\u8981\u7528\u6765\u6d4b\u8bd5PostgreSQL 18&#xff09;<\/li>\n<li>\u5ba2\u6237\u7aef&#xff1a;Windows 10 &#043; PowerShell 7&#xff08;\u6211\u5e38\u7528\u7684\u5de5\u4f5c\u73af\u5883&#xff09;<\/li>\n<li>SSH\u7aef\u53e3&#xff1a;40131&#xff08;\u7279\u610f\u4fee\u6539\u4e86\u975e\u9ed8\u8ba4\u7aef\u53e3&#xff0c;\u964d\u4f4e\u88ab\u626b\u63cf\u7684\u98ce\u9669&#xff09;<\/li>\n<li>\u8f85\u52a9\u5de5\u5177&#xff1a;Trea AI&#xff08;\u7528\u6765\u6267\u884c\u548c\u7ba1\u7406\u547d\u4ee4&#xff0c;\u51cf\u5c11\u624b\u52a8\u8f93\u5165\u9519\u8bef&#xff09;<\/li>\n<li>\u5bc6\u94a5\u7c7b\u578b&#xff1a;RSA 4096\u4f4d&#xff08;\u6bd4\u9ed8\u8ba4\u76842048\u4f4d\u66f4\u5b89\u5168&#xff09;<\/li>\n<\/ul>\n<h3>\u4e8c\u3001\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u8fc7\u7a0b<\/h3>\n<h4>1. \u51c6\u5907\u5de5\u4f5c&#xff1a;\u68b3\u7406\u767b\u5f55\u4fe1\u606f\u4e0e\u73af\u5883\u68c0\u67e5<\/h4>\n<p>\u5728\u914d\u7f6e\u4e4b\u524d&#xff0c;\u6211\u5148\u6574\u7406\u4e86\u670d\u52a1\u5668\u7684\u5173\u952e\u4fe1\u606f&#xff0c;\u5b58\u653e\u5728\u672c\u5730\u52a0\u5bc6\u6587\u4ef6\u4e2d&#xff08;\u7528Bitwarden\u7ba1\u7406&#xff0c;\u5b89\u5168\u53c8\u65b9\u4fbf&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u4fe1\u606f\u9879\u5177\u4f53\u5185\u5bb9\u5907\u6ce8<\/tr>\n<tbody>\n<tr>\n<td>IP\u5730\u5740<\/td>\n<td>192.168.1.100<\/td>\n<td>\u5b9e\u9645IP\u5df2\u9690\u85cf&#xff0c;\u7528\u793a\u4f8bIP\u4ee3\u66ff<\/td>\n<\/tr>\n<tr>\n<td>SSH\u7aef\u53e3<\/td>\n<td>40131<\/td>\n<td>\u975e\u9ed8\u8ba4\u7aef\u53e3&#xff0c;\u9700\u7279\u6b8a\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6237\u540d<\/td>\n<td>user<\/td>\n<td>\u666e\u901a\u7528\u6237&#xff0c;\u5c06\u914d\u7f6esudo\u514d\u5bc6<\/td>\n<\/tr>\n<tr>\n<td>\u521d\u59cb\u5bc6\u7801<\/td>\n<td>P&#064;ssw0rd123<\/td>\n<td>\u9996\u6b21\u767b\u5f55\u7528&#xff0c;\u914d\u7f6e\u5b8c\u6210\u540e\u53ef\u66f4\u6539<\/td>\n<\/tr>\n<tr>\n<td>\u7cfb\u7edf\u7248\u672c<\/td>\n<td>Ubuntu 24.04 LTS<\/td>\n<td>\u5168\u65b0\u5b89\u88c5&#xff0c;\u672a\u914d\u7f6e\u5176\u4ed6\u670d\u52a1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6211\u7684\u51c6\u5907\u5de5\u4f5c\u4e60\u60ef&#xff1a;<\/p>\n<ul>\n<li>\u65b0\u670d\u52a1\u5668\u9996\u6b21\u767b\u5f55\u540e&#xff0c;\u7acb\u5373\u4fee\u6539\u9ed8\u8ba4\u5bc6\u7801&#xff0c;\u7981\u7528root\u8fdc\u7a0b\u767b\u5f55<\/li>\n<li>\u8bb0\u5f55\u6240\u6709\u5173\u952e\u914d\u7f6e\u5230\u52a0\u5bc6\u5bc6\u7801\u7ba1\u7406\u5668&#xff0c;\u907f\u514d\u9057\u5fd8<\/li>\n<li>\u914d\u7f6e\u670d\u52a1\u5668IP\u4e3a\u9759\u6001IP&#xff0c;\u9632\u6b62IP\u53d8\u52a8\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25<\/li>\n<li>\u5b89\u88c5\u57fa\u7840\u5de5\u5177\u5305&#xff1a;sudo apt install -y curl wget vim git net-tools<\/li>\n<\/ul>\n<h4>2. \u914d\u7f6esudo\u514d\u5bc6\u7801&#xff1a;\u8e29\u4e86\u7b2c\u4e00\u4e2a\u5751&#xff08;\u6743\u9650\u7ba1\u7406\u7684\u91cd\u8981\u6027&#xff09;<\/h4>\n<p>\u9996\u5148\u8981\u89e3\u51b3sudo\u6bcf\u6b21\u90fd\u8981\u8f93\u5165\u5bc6\u7801\u7684\u95ee\u9898\u3002\u6211\u6700\u521d\u7684\u547d\u4ee4\u662f\u8fd9\u6837\u7684&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u9519\u8bef\u793a\u4f8b&#xff1a;\u76f4\u63a5\u7f16\u8f91sudoers\u6587\u4ef6&#xff0c;\u98ce\u9669\u6781\u9ad8&#xff01;<\/span><br \/>\n<span class=\"token function\">ssh<\/span> -t -p <span class=\"token number\">40131<\/span> user&#064;192.168.1.100 <span class=\"token string\">&#039;echo &#034;user ALL&#061;(ALL:ALL) NOPASSWD: ALL&#034; &gt;&gt; \/etc\/sudoers&#039;<\/span><\/p>\n<p>\u8e29\u5751\u7ecf\u5386&#xff1a;<\/p>\n<ul>\n<li>\u7b2c\u4e00\u6b21\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u65f6&#xff0c;\u7cfb\u7edf\u63d0\u793a&#xff1a;\/etc\/sudoers: syntax error near line 101<\/li>\n<li>\u7ed3\u679c\u5bfc\u81f4sudo\u547d\u4ee4\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528&#xff0c;\u5dee\u70b9\u628a\u7cfb\u7edf\u641e\u5d29&#xff01;\u6211\u5f53\u65f6\u51b7\u6c57\u90fd\u51fa\u6765\u4e86&#xff0c;\u56e0\u4e3a\u670d\u52a1\u5668\u521a\u642d\u5efa&#xff0c;\u8fd8\u6ca1\u5907\u4efd\u7cfb\u7edf\u3002<\/li>\n<li>\u540e\u6765\u67e5\u8d44\u6599\u624d\u77e5\u9053&#xff0c;\u76f4\u63a5\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6\u662f\u8fd0\u7ef4\u5927\u5fcc&#xff0c;\u4e00\u65e6\u8bed\u6cd5\u9519\u8bef\u5c31\u4f1a\u5bfc\u81f4sudo\u5931\u6548&#xff0c;\u4e25\u91cd\u5f71\u54cd\u7cfb\u7edf\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<ul>\n<li>\u6211\u5f53\u65f6\u7684\u7d27\u6025\u5904\u7406&#xff1a;\u91cd\u542f\u670d\u52a1\u5668\u8fdb\u5165\u5355\u7528\u6237\u6a21\u5f0f&#xff0c;\u624b\u52a8\u4fee\u590d\u4e86sudoers\u6587\u4ef6<\/li>\n<li>\u6b63\u786e\u7684\u505a\u6cd5\u662f\u5728\/etc\/sudoers.d\/\u76ee\u5f55\u4e0b\u521b\u5efa\u5355\u72ec\u7684\u914d\u7f6e\u6587\u4ef6&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u4fee\u6539\u4e3b\u6587\u4ef6<\/li>\n<li>\u53ef\u4ee5\u7528visudo\u547d\u4ee4\u6765\u786e\u4fdd\u8bed\u6cd5\u6b63\u786e&#xff0c;\u4f46\u6211\u7528\u4e86\u66f4\u7b80\u5355\u7684\u65b9\u6cd5&#xff1a;<\/li>\n<\/ul>\n<p><span class=\"token comment\"># \u6b63\u786e\u505a\u6cd5&#xff1a;\u521b\u5efa\u5355\u72ec\u7684sudoers\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">ssh<\/span> -t -p <span class=\"token number\">40131<\/span> user&#064;192.168.1.100 <span class=\"token string\">&#039;echo &#034;user ALL&#061;(ALL:ALL) NOPASSWD: ALL&#034; &gt; \/etc\/sudoers.d\/user&#039;<\/span> <\/p>\n<p>\u4e3a\u4ec0\u4e48\u66f4\u5b89\u5168&#xff1f;<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u7528\u6237\u7684sudo\u6743\u9650\u5355\u72ec\u7ba1\u7406&#xff0c;\u4fbf\u4e8e\u7ef4\u62a4<\/li>\n<li>\u5373\u4f7f\u914d\u7f6e\u6709\u8bef&#xff0c;\u4e5f\u4e0d\u4f1a\u5f71\u54cd\u4e3bsudoers\u6587\u4ef6<\/li>\n<li>\u7cfb\u7edf\u4f1a\u81ea\u52a8\u68c0\u67e5\u8bed\u6cd5&#xff0c;\u5b89\u5168\u53ef\u9760<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6\u6743\u9650\u7531\u7cfb\u7edf\u81ea\u52a8\u8bbe\u7f6e\u4e3a440&#xff0c;\u9632\u6b62\u610f\u5916\u4fee\u6539<\/li>\n<\/ul>\n<p>\u6211\u7684sudo\u6743\u9650\u7ba1\u7406\u5b9e\u8df5&#xff1a;<\/p>\n<ul>\n<li>\u6d4b\u8bd5\u670d\u52a1\u5668\u53ef\u4ee5\u914d\u7f6eNOPASSWD: ALL&#xff0c;\u65b9\u4fbf\u8c03\u8bd5<\/li>\n<li>\u751f\u4ea7\u670d\u52a1\u5668\u5fc5\u987b\u4e25\u683c\u9650\u5236sudo\u547d\u4ee4\u8303\u56f4&#xff0c;\u53ea\u5141\u8bb8\u6267\u884c\u5fc5\u8981\u7684\u547d\u4ee4<\/li>\n<li>\u5b9a\u671f\u5ba1\u67e5sudo\u6743\u9650&#xff0c;\u79fb\u9664\u4e0d\u518d\u9700\u8981\u7684\u6743\u9650<\/li>\n<li>\u4e3a\u4e0d\u540c\u89d2\u8272\u521b\u5efa\u4e0d\u540c\u7684sudo\u914d\u7f6e\u6587\u4ef6&#xff0c;\u5982\/etc\/sudoers.d\/dev\u3001\/etc\/sudoers.d\/ops<\/li>\n<\/ul>\n<h4>3. \u751f\u6210SSH\u5bc6\u94a5\u5bf9&#xff1a;\u5bc6\u94a5\u7ba1\u7406\u662f\u8fd0\u7ef4\u5b89\u5168\u7684\u57fa\u77f3<\/h4>\n<p>\u63a5\u4e0b\u6765\u751f\u6210SSH\u5bc6\u94a5\u5bf9\u3002\u6211\u4e60\u60ef\u4e3a\u4e0d\u540c\u7c7b\u578b\u7684\u670d\u52a1\u5668\u4f7f\u7528\u4e0d\u540c\u7684\u5bc6\u94a5&#xff0c;\u65b9\u4fbf\u7ba1\u7406&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u751f\u62104096\u4f4dRSA\u5bc6\u94a5&#xff0c;\u6307\u5b9a\u6587\u4ef6\u540d\u548c\u6ce8\u91ca<\/span><br \/>\n <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#039;\u751f\u6210SSH\u5bc6\u94a5\u5bf9&#8230;&#039;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> ssh-keygen -t rsa -b <span class=\"token number\">4096<\/span> -C <span class=\"token string\">&#034;ubuntu-test-server-2025&#034;<\/span> -f <span class=\"token string\">&#034;<span class=\"token environment constant\">$HOME<\/span>\/.ssh\/id_rsa_ubuntu_test&#034;<\/span> -N <span class=\"token string\">&#034;&#034;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#039;\u5bc6\u94a5\u751f\u6210\u5b8c\u6210&#xff01;&#039;<\/span><\/p>\n<p>\u5b9e\u9645\u6267\u884c\u6548\u679c&#xff1a;<\/p>\n<p>\u751f\u6210SSH\u5bc6\u94a5\u5bf9&#8230;<br \/>\nGenerating public\/private rsa key pair.<br \/>\nYour identification has been saved in \/home\/user\/.ssh\/id_rsa_ubuntu_test.<br \/>\nYour public key has been saved in \/home\/user\/.ssh\/id_rsa_ubuntu_test.pub.<br \/>\nThe key fingerprint is:<br \/>\nSHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ubuntu-test-server-2025<br \/>\nThe key&#039;s randomart image is:<br \/>\n&#043;&#8212;[RSA 4096]&#8212;-&#043;<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n|                 |<br \/>\n&#043;&#8212;-[SHA256]&#8212;&#8211;&#043;<br \/>\n\u5bc6\u94a5\u751f\u6210\u5b8c\u6210&#xff01;<\/p>\n<p>\u6211\u7684\u5bc6\u94a5\u7ba1\u7406\u5b9e\u8df5&#xff1a;<\/p>\n<ul>\n<li>\u4e3a\u4e0d\u540c\u73af\u5883&#xff08;\u6d4b\u8bd5\u3001\u751f\u4ea7&#xff09;\u4f7f\u7528\u4e0d\u540c\u5bc6\u94a5&#xff0c;\u9632\u6b62\u6d4b\u8bd5\u5bc6\u94a5\u6cc4\u9732\u5f71\u54cd\u751f\u4ea7\u73af\u5883<\/li>\n<li>\u5bc6\u94a5\u6587\u4ef6\u540d\u5305\u542b\u670d\u52a1\u5668\u7528\u9014\u548c\u5e74\u4efd&#xff0c;\u5982id_rsa_prod_web_2025&#xff0c;\u65b9\u4fbf\u533a\u5206<\/li>\n<li>\u751f\u4ea7\u670d\u52a1\u5668\u7684\u5bc6\u94a5\u5fc5\u987b\u8bbe\u7f6e\u5bc6\u7801\u4fdd\u62a4&#xff1a;ssh-keygen -p -f ~\/.ssh\/id_rsa_prod<\/li>\n<li>\u5b9a\u671f&#xff08;\u6bcf6\u4e2a\u6708&#xff09;\u66f4\u6362\u5bc6\u94a5\u5bf9&#xff0c;\u5c24\u5176\u662f\u751f\u4ea7\u73af\u5883\u7684\u5bc6\u94a5<\/li>\n<li>\u5bc6\u94a5\u5907\u4efd\u5230\u52a0\u5bc6\u7684\u4e91\u5b58\u50a8&#xff0c;\u9632\u6b62\u672c\u5730\u8bbe\u5907\u4e22\u5931<\/li>\n<li>\u79bb\u804c\u6216\u6362\u8bbe\u5907\u65f6&#xff0c;\u7acb\u5373\u5220\u9664\u670d\u52a1\u5668\u4e0a\u7684\u65e7\u516c\u94a5<\/li>\n<\/ul>\n<p>\u8e29\u5751\u7ecf\u5386&#xff1a;<\/p>\n<ul>\n<li>\u4ee5\u524d\u6211\u66fe\u4e3a\u6240\u6709\u670d\u52a1\u5668\u4f7f\u7528\u540c\u4e00\u4e2a\u5bc6\u94a5&#xff0c;\u7ed3\u679c\u6709\u4e00\u6b21\u672c\u5730\u7535\u8111\u88ab\u76d7&#xff0c;\u6211\u4e0d\u5f97\u4e0d\u7d27\u6025\u66f4\u6362\u6240\u6709\u670d\u52a1\u5668\u7684\u5bc6\u94a5&#xff0c;\u8017\u65f6\u4e00\u6574\u5929<\/li>\n<li>\u4ece\u90a3\u4ee5\u540e&#xff0c;\u6211\u5c31\u517b\u6210\u4e86\u4e3a\u4e0d\u540c\u73af\u5883\u4f7f\u7528\u4e0d\u540c\u5bc6\u94a5\u7684\u4e60\u60ef&#xff0c;\u5927\u5927\u964d\u4f4e\u4e86\u5b89\u5168\u98ce\u9669<\/li>\n<\/ul>\n<h4>4. \u914d\u7f6eSSH\u514d\u5bc6\u767b\u5f55&#xff1a;\u6743\u9650\u7ec6\u8282\u51b3\u5b9a\u6210\u8d25<\/h4>\n<p>\u73b0\u5728\u9700\u8981\u628a\u516c\u94a5\u4f20\u5230\u670d\u52a1\u5668\u5e76\u914d\u7f6e\u6b63\u786e\u7684\u6743\u9650\u3002\u8fd9\u4e00\u6b65\u6743\u9650\u8bbe\u7f6e\u975e\u5e38\u91cd\u8981&#xff0c;\u5426\u5219\u5bc6\u94a5\u8ba4\u8bc1\u4f1a\u5931\u8d25&#xff01;<\/p>\n<p><span class=\"token comment\"># \u6b65\u9aa41&#xff1a;\u4e0a\u4f20\u516c\u94a5\u5230\u670d\u52a1\u5668<\/span><br \/>\n<span class=\"token function\">scp<\/span> -P <span class=\"token number\">40131<\/span> <span class=\"token string\">&#034;<span class=\"token environment constant\">$HOME<\/span>\/.ssh\/id_rsa_ubuntu_test.pub&#034;<\/span> user&#064;192.168.1.100:\/tmp\/<\/p>\n<p><span class=\"token comment\"># \u6b65\u9aa42&#xff1a;\u914d\u7f6e\u516c\u94a5\u548c\u6743\u9650<\/span><br \/>\n<span class=\"token function\">ssh<\/span> -t -p <span class=\"token number\">40131<\/span> user&#064;192.168.1.100 <span class=\"token string\">&#039;mkdir -p ~\/.ssh &amp;&amp; cat \/tmp\/id_rsa_ubuntu_test.pub &gt;&gt; ~\/.ssh\/authorized_keys &amp;&amp; chmod 700 ~\/.ssh &amp;&amp; chmod 600 ~\/.ssh\/authorized_keys &amp;&amp; rm \/tmp\/id_rsa_ubuntu_test.pub&#039;<\/span><\/p>\n<p>\u5b9e\u9645\u6267\u884c\u6548\u679c&#xff1a;<\/p>\n<p>id_rsa_ubuntu_test.pub                                   100%  744     0.7KB\/s   00:00    <\/p>\n<p>\u8e29\u5751\u7ecf\u5386&#xff1a;<\/p>\n<ul>\n<li>\u7b2c\u4e00\u6b21\u914d\u7f6e\u65f6&#xff0c;\u6211\u5fd8\u4e86\u8bbe\u7f6e~\/.ssh\u76ee\u5f55\u7684\u6743\u9650&#xff0c;\u5bfc\u81f4\u5bc6\u94a5\u8ba4\u8bc1\u5931\u8d25<\/li>\n<li>\u68c0\u67e5\u65e5\u5fd7\u53d1\u73b0&#xff1a;Authentication refused: bad ownership or modes for directory \/home\/user\/.ssh<\/li>\n<li>\u5f53\u65f6\u6211\u53cd\u590d\u68c0\u67e5\u5bc6\u94a5&#xff0c;\u786e\u8ba4\u516c\u94a5\u5df2\u7ecf\u6b63\u786e\u6dfb\u52a0&#xff0c;\u4f46\u5c31\u662f\u65e0\u6cd5\u514d\u5bc6\u767b\u5f55&#xff0c;\u6298\u817e\u4e86\u534a\u5c0f\u65f6\u624d\u53d1\u73b0\u662f\u6743\u9650\u95ee\u9898<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<ul>\n<li>\u786e\u4fdd~\/.ssh\u76ee\u5f55\u6743\u9650\u662f700&#xff08;\u53ea\u6709\u6240\u6709\u8005\u53ef\u8bfb\u5199\u6267\u884c&#xff09;&#xff1a;chmod 700 ~\/.ssh<\/li>\n<li>\u786e\u4fddauthorized_keys\u6587\u4ef6\u6743\u9650\u662f600&#xff08;\u53ea\u6709\u6240\u6709\u8005\u53ef\u8bfb\u5199&#xff09;&#xff1a;chmod 600 ~\/.ssh\/authorized_keys<\/li>\n<li>\u786e\u4fdd\u7528\u6237\u4e3b\u76ee\u5f55\u6743\u9650\u4e0d\u8d85\u8fc7755&#xff1a;chmod 755 ~<\/li>\n<li>\u53ef\u4ee5\u7528ssh -v ubuntu-test\u67e5\u770b\u8be6\u7ec6\u7684\u8ba4\u8bc1\u8fc7\u7a0b&#xff0c;\u65b9\u4fbf\u6392\u67e5\u95ee\u9898<\/li>\n<\/ul>\n<p>\u6743\u9650\u8bbe\u7f6e\u7684\u539f\u7406&#xff1a;<\/p>\n<ul>\n<li>SSH\u670d\u52a1\u5668\u5bf9\u5bc6\u94a5\u6587\u4ef6\u7684\u6743\u9650\u8981\u6c42\u975e\u5e38\u4e25\u683c&#xff0c;\u8fd9\u662f\u51fa\u4e8e\u5b89\u5168\u8003\u8651<\/li>\n<li>\u5982\u679c\u6743\u9650\u8fc7\u4e8e\u5bbd\u677e&#xff0c;\u53ef\u80fd\u88ab\u5176\u4ed6\u7528\u6237\u4fee\u6539\u5bc6\u94a5\u6587\u4ef6&#xff0c;\u5bfc\u81f4\u5b89\u5168\u6f0f\u6d1e<\/li>\n<li>\u6240\u4ee5SSH\u4f1a\u62d2\u7edd\u4f7f\u7528\u6743\u9650\u4e0d\u6b63\u786e\u7684\u5bc6\u94a5\u6587\u4ef6\u8fdb\u884c\u8ba4\u8bc1<\/li>\n<\/ul>\n<p>\u6211\u7684\u6743\u9650\u68c0\u67e5\u4e60\u60ef&#xff1a;<\/p>\n<ul>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u6211\u4f1a\u7acb\u5373\u6267\u884c\u6743\u9650\u68c0\u67e5\u547d\u4ee4&#xff1a;<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;ls -la ~ ~\/.ssh ~\/.ssh\/authorized_keys&#039;<\/span>\n <\/li>\n<li>\u786e\u4fdd\u6743\u9650\u8bbe\u7f6e\u6b63\u786e\u540e&#xff0c;\u518d\u8fdb\u884c\u514d\u5bc6\u767b\u5f55\u6d4b\u8bd5<\/li>\n<\/ul>\n<h4>5. \u914d\u7f6eSSH Config&#xff1a;\u591a\u670d\u52a1\u5668\u7ba1\u7406\u7684\u9ad8\u6548\u5de5\u5177<\/h4>\n<p>\u5982\u679c\u6709\u591a\u4e2a\u670d\u52a1\u5668&#xff0c;\u6bcf\u6b21\u767b\u5f55\u90fd\u8981\u8f93\u5165-i\u548c-p\u53c2\u6570\u5f88\u9ebb\u70e6\u3002\u6211\u63a8\u8350\u914d\u7f6e~\/.ssh\/config\u6587\u4ef6&#xff0c;\u7b80\u5316\u767b\u5f55&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u6216\u7f16\u8f91SSH\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#039;Host ubuntu-test<br \/>\n  HostName 192.168.1.100<br \/>\n  Port 40131<br \/>\n  User user<br \/>\n  IdentityFile ~\/.ssh\/id_rsa_ubuntu_test<br \/>\n  ServerAliveInterval 30<br \/>\n  ServerAliveCountMax 3&#039;<\/span> <span class=\"token operator\">&gt;&gt;<\/span> ~\/.ssh\/config<\/p>\n<p>\u5b9e\u9645\u6548\u679c&#xff1a;<\/p>\n<ul>\n<li>\u4ee5\u524d\u767b\u5f55\u9700\u8981\u8f93\u5165&#xff1a;ssh -i ~\/.ssh\/id_rsa_ubuntu_test -p 40131 user&#064;192.168.1.100<\/li>\n<li>\u73b0\u5728\u53ea\u9700\u8981\u8f93\u5165&#xff1a;ssh ubuntu-test<\/li>\n<li>\u6548\u7387\u63d0\u5347\u4e86\u4e0d\u6b62\u4e00\u500d&#xff01;<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>Host&#xff1a;\u81ea\u5b9a\u4e49\u670d\u52a1\u5668\u522b\u540d&#xff0c;\u767b\u5f55\u65f6\u76f4\u63a5\u7528ssh ubuntu-test<\/li>\n<li>IdentityFile&#xff1a;\u6307\u5b9a\u5bc6\u94a5\u6587\u4ef6\u8def\u5f84<\/li>\n<li>ServerAliveInterval&#xff1a;\u6bcf\u969430\u79d2\u53d1\u9001\u5fc3\u8df3\u5305&#xff0c;\u9632\u6b62\u8fde\u63a5\u8d85\u65f6<\/li>\n<li>ServerAliveCountMax&#xff1a;\u6700\u591a\u5141\u8bb83\u6b21\u5fc3\u8df3\u5305\u5931\u8d25<\/li>\n<\/ul>\n<p>\u6211\u7684SSH Config\u6700\u4f73\u5b9e\u8df5&#xff1a;<\/p>\n<ul>\n<li>\u4e3a\u4e0d\u540c\u73af\u5883\u5206\u7ec4\u914d\u7f6e&#xff0c;\u5982Host prod-*\u3001Host test-*<\/li>\n<li>\u4e3a\u5e38\u7528\u670d\u52a1\u5668\u8bbe\u7f6e\u7b80\u77ed\u522b\u540d&#xff0c;\u5982Host web1\u3001Host db1<\/li>\n<li>\u914d\u7f6e\u9ed8\u8ba4\u9009\u9879&#xff0c;\u5982Host *\u4e0b\u8bbe\u7f6e\u901a\u7528\u7684ServerAliveInterval<\/li>\n<li>\u6dfb\u52a0ForwardAgent yes\u9009\u9879&#xff0c;\u652f\u6301\u5bc6\u94a5\u4ee3\u7406\u8f6c\u53d1<\/li>\n<li>\u4f7f\u7528ProxyJump\u914d\u7f6e\u8df3\u677f\u673a&#xff0c;\u7b80\u5316\u591a\u8282\u70b9\u8bbf\u95ee<\/li>\n<\/ul>\n<p>\u9ad8\u7ea7\u914d\u7f6e\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5\u73af\u5883\u670d\u52a1\u5668\u5206\u7ec4\u914d\u7f6e<\/span><br \/>\nHost test-*<br \/>\n  User user<br \/>\n  IdentityFile ~\/.ssh\/id_rsa_test<br \/>\n  ServerAliveInterval <span class=\"token number\">30<\/span><\/p>\n<p><span class=\"token comment\"># \u751f\u4ea7\u73af\u5883\u670d\u52a1\u5668\u5206\u7ec4\u914d\u7f6e  <\/span><br \/>\nHost prod-*<br \/>\n  User prod-user<br \/>\n  IdentityFile ~\/.ssh\/id_rsa_prod<br \/>\n  ServerAliveInterval <span class=\"token number\">60<\/span><br \/>\n  ForwardAgent <span class=\"token function\">yes<\/span><\/p>\n<p><span class=\"token comment\"># \u8df3\u677f\u673a\u914d\u7f6e<\/span><br \/>\nHost jump-server<br \/>\n  HostName <span class=\"token number\">10.0<\/span>.0.1<br \/>\n  Port <span class=\"token number\">22<\/span><br \/>\n  User jump-user<br \/>\n  IdentityFile ~\/.ssh\/id_rsa_jump<\/p>\n<p><span class=\"token comment\"># \u901a\u8fc7\u8df3\u677f\u673a\u8bbf\u95ee\u5185\u90e8\u670d\u52a1\u5668<\/span><br \/>\nHost internal-*<br \/>\n  ProxyJump jump-server<br \/>\n  User internal-user<br \/>\n  IdentityFile ~\/.ssh\/id_rsa_internal<\/p>\n<h3>\u4e09\u3001\u6d4b\u8bd5\u9a8c\u8bc1&#xff1a;\u786e\u4fdd\u914d\u7f6e\u751f\u6548<\/h3>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u4e00\u5b9a\u8981\u8fdb\u884c\u5168\u9762\u6d4b\u8bd5&#xff0c;\u786e\u4fdd\u6bcf\u4e2a\u73af\u8282\u90fd\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<h4>1. SSH\u65e0\u5bc6\u7801\u767b\u5f55\u6d4b\u8bd5<\/h4>\n<p><span class=\"token comment\"># \u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u767b\u5f55&#xff0c;\u65e0\u9700\u5bc6\u7801\u548c\u53c2\u6570<\/span><br \/>\n<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;whoami &amp;&amp; hostname&#039;<\/span><\/p>\n<p>\u9884\u671f\u8f93\u51fa&#xff1a;<\/p>\n<p>user<br \/>\nubuntu-test-server<\/p>\n<h4>2. sudo\u514d\u5bc6\u7801\u6d4b\u8bd5<\/h4>\n<p><span class=\"token comment\"># \u6267\u884c\u9700\u8981sudo\u6743\u9650\u7684\u547d\u4ee4&#xff0c;\u65e0\u9700\u5bc6\u7801<\/span><br \/>\n<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;sudo apt update &amp;&amp; sudo apt upgrade -y&#039;<\/span><\/p>\n<p>\u6d4b\u8bd5\u7ed3\u679c&#xff1a;\u547d\u4ee4\u6210\u529f\u6267\u884c&#xff0c;\u6ca1\u6709\u4efb\u4f55\u5bc6\u7801\u63d0\u793a&#xff0c;\u5b8c\u7f8e&#xff01;<\/p>\n<h4>3. \u5b9e\u9645\u5e94\u7528\u6d4b\u8bd5&#xff1a;PostgreSQL\u64cd\u4f5c<\/h4>\n<p>\u6211\u7528\u8fd9\u53f0\u670d\u52a1\u5668\u6d4b\u8bd5PostgreSQL 18&#xff0c;\u6b63\u597d\u9a8c\u8bc1\u514d\u5bc6\u767b\u5f55\u7684\u5b9e\u9645\u6548\u679c&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5b89\u88c5PostgreSQL 18<\/span><br \/>\n<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;sudo apt install -y postgresql-18&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770bPostgreSQL\u7248\u672c<\/span><br \/>\n<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;sudo -u postgres psql -c &#034;SELECT version();&#034;&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u6d4b\u8bd5\u6570\u636e\u5e93<\/span><br \/>\n<span class=\"token function\">ssh<\/span> ubuntu-test <span class=\"token string\">&#039;sudo -u postgres psql -c &#034;CREATE DATABASE test_db;&#034;&#039;<\/span><\/p>\n<p>\u6d4b\u8bd5\u7ed3\u679c&#xff1a;\u6240\u6709\u547d\u4ee4\u90fd\u987a\u5229\u6267\u884c&#xff0c;\u6ca1\u6709\u4efb\u4f55\u5bc6\u7801\u63d0\u793a&#xff0c;\u6548\u7387\u63d0\u5347\u660e\u663e&#xff01;<\/p>\n<h3>\u56db\u3001AI\u5de5\u5177\u7684\u5b9e\u9645\u5e2e\u52a9&#xff1a;\u63d0\u9ad8\u6548\u7387\u7684\u667a\u80fd\u52a9\u624b<\/h3>\n<p>\u8fd9\u6b21\u914d\u7f6e\u8fc7\u7a0b\u4e2d&#xff0c;Trea AI\u786e\u5b9e\u5e2e\u4e86\u6211\u4e0d\u5c11\u5fd9&#xff0c;\u8ba9\u6211\u6df1\u523b\u4f53\u4f1a\u5230AI\u5de5\u5177\u5728\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7684\u4ef7\u503c&#xff1a;<\/p>\n<h4>1. \u547d\u4ee4\u6267\u884c\u4e0e\u81ea\u52a8\u5316<\/h4>\n<ul>\n<li>\u81ea\u52a8\u751f\u6210\u590d\u6742\u547d\u4ee4&#xff1a;\u6bd4\u5982\u751f\u62104096\u4f4dRSA\u5bc6\u94a5\u7684\u5b8c\u6574\u547d\u4ee4<\/li>\n<li>\u6279\u91cf\u6267\u884c\u547d\u4ee4&#xff1a;\u4e00\u6b21\u6027\u6267\u884csudo\u914d\u7f6e\u3001\u5bc6\u94a5\u4e0a\u4f20\u548c\u6743\u9650\u8bbe\u7f6e<\/li>\n<li>\u547d\u4ee4\u6267\u884c\u7ed3\u679c\u5b9e\u65f6\u53cd\u9988&#xff0c;\u65b9\u4fbf\u8c03\u8bd5\u548c\u9a8c\u8bc1<\/li>\n<li>\u652f\u6301\u547d\u4ee4\u6a21\u677f\u4fdd\u5b58&#xff0c;\u4fbf\u4e8e\u540e\u7eed\u590d\u7528<\/li>\n<\/ul>\n<h4>2. \u95ee\u9898\u6392\u67e5\u4e0e\u667a\u80fd\u89e3\u51b3\u65b9\u6848<\/h4>\n<ul>\n<li>\u5f53\u6211\u7b2c\u4e00\u6b21\u914d\u7f6esudo\u51fa\u9519\u65f6&#xff0c;AI\u7acb\u523b\u5206\u6790\u4e86\u9519\u8bef\u4fe1\u606f&#xff0c;\u63d0\u793a\u6211\u76f4\u63a5\u7f16\u8f91\/etc\/sudoers\u7684\u98ce\u9669<\/li>\n<li>\u63d0\u4f9b\u4e86\u591a\u79cd\u89e3\u51b3\u65b9\u6848&#xff0c;\u5305\u62ec\u7d27\u6025\u4fee\u590d\u65b9\u6cd5\u548c\u6b63\u786e\u7684\u914d\u7f6e\u6b65\u9aa4<\/li>\n<li>\u5e2e\u6211\u751f\u6210\u4e86\u8be6\u7ec6\u7684SSH Config\u914d\u7f6e&#xff0c;\u5305\u542b\u4e86\u6700\u4f73\u5b9e\u8df5\u9009\u9879<\/li>\n<li>\u5f53\u5bc6\u94a5\u8ba4\u8bc1\u5931\u8d25\u65f6&#xff0c;AI\u5f15\u5bfc\u6211\u68c0\u67e5\u6743\u9650\u8bbe\u7f6e&#xff0c;\u5e2e\u6211\u5feb\u901f\u5b9a\u4f4d\u95ee\u9898<\/li>\n<\/ul>\n<h4>3. \u5b89\u5168\u63d0\u9192\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h4>\n<ul>\n<li>\u4e3b\u52a8\u63d0\u9192\u6211\u4e0d\u8981\u76f4\u63a5\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6&#xff0c;\u5efa\u8bae\u4f7f\u7528\/etc\/sudoers.d\/\u76ee\u5f55<\/li>\n<li>\u5efa\u8bae\u6211\u4e3a\u4e0d\u540c\u670d\u52a1\u5668\u4f7f\u7528\u4e0d\u540c\u7684\u5bc6\u94a5&#xff0c;\u63d0\u9ad8\u5b89\u5168\u6027<\/li>\n<li>\u63d0\u793a\u6211\u5b9a\u671f\u66f4\u6362\u5bc6\u94a5\u5bf9&#xff0c;\u589e\u5f3a\u7cfb\u7edf\u5b89\u5168<\/li>\n<li>\u63d0\u4f9b\u4e86SSH\u670d\u52a1\u52a0\u56fa\u7684\u5efa\u8bae&#xff0c;\u5982\u7981\u7528root\u767b\u5f55\u3001\u9650\u5236\u5bc6\u7801\u5c1d\u8bd5\u6b21\u6570<\/li>\n<\/ul>\n<h4>4. \u5b66\u4e60\u4e0e\u77e5\u8bc6\u6269\u5c55<\/h4>\n<ul>\n<li>\u89e3\u91ca\u4e86SSH\u5bc6\u94a5\u8ba4\u8bc1\u7684\u539f\u7406&#xff0c;\u8ba9\u6211\u52a0\u6df1\u7406\u89e3<\/li>\n<li>\u4ecb\u7ecd\u4e86\u4e0d\u540c\u5bc6\u94a5\u7c7b\u578b\u7684\u7279\u70b9&#xff0c;\u5982RSA\u3001ED25519\u7b49<\/li>\n<li>\u63d0\u4f9b\u4e86\u751f\u4ea7\u73af\u5883\u7684\u5b89\u5168\u914d\u7f6e\u5efa\u8bae&#xff0c;\u8d85\u51fa\u4e86\u6211\u539f\u672c\u7684\u77e5\u8bc6\u8303\u56f4<\/li>\n<\/ul>\n<p>\u6211\u7684\u771f\u5b9e\u611f\u53d7&#xff1a;<\/p>\n<ul>\n<li>AI\u5de5\u5177\u786e\u5b9e\u80fd\u63d0\u9ad8\u6548\u7387&#xff0c;\u51cf\u5c11\u91cd\u590d\u6027\u5de5\u4f5c<\/li>\n<li>\u4f46\u4e0d\u80fd\u5b8c\u5168\u4f9d\u8d56\u5b83&#xff0c;\u5173\u952e\u8fd8\u662f\u8981\u7406\u89e3\u6bcf\u4e2a\u6b65\u9aa4\u7684\u539f\u7406<\/li>\n<li>\u9002\u5408\u7528\u6765\u8f85\u52a9\u6267\u884c\u547d\u4ee4\u3001\u6392\u67e5\u95ee\u9898\u548c\u5b66\u4e60\u65b0\u77e5\u8bc6<\/li>\n<li>\u53ef\u4ee5\u4f5c\u4e3a\u8fd0\u7ef4\u4eba\u5458\u7684\u667a\u80fd\u52a9\u624b&#xff0c;\u8ba9\u6211\u4eec\u6709\u66f4\u591a\u65f6\u95f4\u5173\u6ce8\u6838\u5fc3\u4e1a\u52a1<\/li>\n<\/ul>\n<p>AI\u5de5\u5177\u4f7f\u7528\u6280\u5de7&#xff1a;<\/p>\n<ul>\n<li>\u6e05\u6670\u63cf\u8ff0\u95ee\u9898&#xff0c;\u63d0\u4f9b\u8db3\u591f\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f<\/li>\n<li>\u9a8c\u8bc1AI\u751f\u6210\u7684\u547d\u4ee4&#xff0c;\u5c24\u5176\u662f\u6d89\u53ca\u7cfb\u7edf\u914d\u7f6e\u7684\u547d\u4ee4<\/li>\n<li>\u7ed3\u5408\u81ea\u5df1\u7684\u7ecf\u9a8c\u5224\u65adAI\u5efa\u8bae\u7684\u5408\u7406\u6027<\/li>\n<li>\u5229\u7528AI\u5de5\u5177\u5b66\u4e60\u65b0\u6280\u672f&#xff0c;\u6269\u5c55\u81ea\u5df1\u7684\u77e5\u8bc6\u9762<\/li>\n<\/ul>\n<h3>\u4e94\u3001\u5b89\u5168\u52a0\u56fa\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<p>\u914d\u7f6e\u514d\u5bc6\u767b\u5f55\u867d\u7136\u65b9\u4fbf&#xff0c;\u4f46\u5b89\u5168\u95ee\u9898\u7edd\u4e0d\u80fd\u5ffd\u89c6\u3002\u4f5c\u4e3a\u4e00\u540d\u8d44\u6df1\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u6df1\u77e5\u5b89\u5168\u662f\u8fd0\u7ef4\u5de5\u4f5c\u7684\u5e95\u7ebf\u3002\u4ee5\u4e0b\u662f\u6211\u7684\u4e00\u4e9b\u5b89\u5168\u5b9e\u8df5&#xff1a;<\/p>\n<h4>1. \u5bc6\u94a5\u4fdd\u62a4&#xff1a;\u8fd0\u7ef4\u5b89\u5168\u7684\u6838\u5fc3<\/h4>\n<ul>\n<li>\u751f\u4ea7\u73af\u5883\u7684\u5bc6\u94a5\u4e00\u5b9a\u8981\u8bbe\u7f6e\u5bc6\u7801\u4fdd\u62a4&#xff1a;ssh-keygen -p -f ~\/.ssh\/id_rsa_production<\/li>\n<li>\u79c1\u94a5\u6587\u4ef6\u6743\u9650\u5fc5\u987b\u662f600&#xff1a;chmod 600 ~\/.ssh\/id_rsa_*<\/li>\n<li>\u5b9a\u671f\u5907\u4efd\u5bc6\u94a5\u5230\u52a0\u5bc6\u7684\u4e91\u5b58\u50a8&#xff08;\u5982Bitwarden\u30011Password&#xff09;&#xff0c;\u9632\u6b62\u672c\u5730\u8bbe\u5907\u4e22\u5931<\/li>\n<li>\u4ece\u4e0d\u5c06\u79c1\u94a5\u6587\u4ef6\u4f20\u8f93\u5230\u4e0d\u5b89\u5168\u7684\u8bbe\u5907\u6216\u7f51\u7edc<\/li>\n<li>\u91cd\u8981\u5bc6\u94a5\u4f7f\u7528\u786c\u4ef6\u5bc6\u94a5&#xff08;\u5982YubiKey&#xff09;\u5b58\u50a8&#xff0c;\u63d0\u4f9b\u7269\u7406\u5b89\u5168\u4fdd\u969c<\/li>\n<\/ul>\n<h4>2. SSH\u670d\u52a1\u52a0\u56fa&#xff1a;\u4ece\u6e90\u5934\u9632\u8303\u98ce\u9669<\/h4>\n<ul>\n<li>\u7981\u7528root\u7528\u6237\u76f4\u63a5\u767b\u5f55&#xff1a;sudo sed -i &#039;s\/PermitRootLogin yes\/PermitRootLogin no\/&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u9650\u5236\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237&#xff1a;sudo sed -i &#039;$a AllowUsers user admin&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u7981\u7528\u5bc6\u7801\u767b\u5f55&#xff08;\u914d\u7f6e\u597d\u5bc6\u94a5\u540e&#xff09;&#xff1a;sudo sed -i &#039;s\/PasswordAuthentication yes\/PasswordAuthentication no\/&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u7981\u7528\u7a7a\u5bc6\u7801\u767b\u5f55&#xff1a;sudo sed -i &#039;s\/PermitEmptyPasswords yes\/PermitEmptyPasswords no\/&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u9650\u5236\u5bc6\u94a5\u8ba4\u8bc1\u5c1d\u8bd5\u6b21\u6570&#xff1a;sudo sed -i &#039;s\/MaxAuthTries 6\/MaxAuthTries 3\/&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u4f7f\u7528\u975e\u9ed8\u8ba4SSH\u7aef\u53e3&#xff08;\u6211\u901a\u5e38\u4f7f\u752840000-50000\u4e4b\u95f4\u7684\u7aef\u53e3&#xff09;<\/li>\n<li>\u91cd\u542fSSH\u670d\u52a1\u5e76\u9a8c\u8bc1&#xff1a;sudo systemctl restart sshd &amp;&amp; sudo systemctl status sshd<\/li>\n<\/ul>\n<h4>3. \u6743\u9650\u7cbe\u7ec6\u63a7\u5236&#xff1a;\u6700\u5c0f\u6743\u9650\u539f\u5219<\/h4>\n<ul>\n<li>\u4e0d\u8981\u7ed9\u7528\u6237\u6240\u6709\u547d\u4ee4\u7684sudo\u6743\u9650&#xff0c;\u5c3d\u91cf\u9650\u5236\u547d\u4ee4\u8303\u56f4<span class=\"token comment\"># \u53ea\u5141\u8bb8\u6267\u884c\u7279\u5b9a\u547d\u4ee4<\/span><br \/>\nuser <span class=\"token assign-left variable\">ALL<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">(<\/span>ALL:ALL<span class=\"token punctuation\">)<\/span> NOPASSWD: \/usr\/bin\/apt, \/usr\/bin\/apt-get, \/usr\/bin\/systemctl restart sshd, \/usr\/bin\/systemctl restart postgresql\n <\/li>\n<li>\u5b9a\u671f\u68c0\u67e5sudoers\u914d\u7f6e&#xff1a;sudo visudo -c<\/li>\n<li>\u542f\u7528sudo\u65e5\u5fd7\u5ba1\u8ba1&#xff1a;sudo sed -i &#039;s\/#Defaults log_input\/Defaults log_input\/&#039; \/etc\/sudoers<\/li>\n<li>\u9650\u5236sudo\u4f1a\u8bdd\u65f6\u957f&#xff1a;sudo sed -i &#039;s\/#Defaults timestamp_timeout&#061;15\/Defaults timestamp_timeout&#061;5\/&#039; \/etc\/sudoers<\/li>\n<\/ul>\n<h4>4. \u7f51\u7edc\u5b89\u5168\u914d\u7f6e&#xff1a;\u9632\u706b\u5899\u4e0e\u8bbf\u95ee\u63a7\u5236<\/h4>\n<ul>\n<li>\u914d\u7f6eUFW\u9632\u706b\u5899&#xff0c;\u53ea\u5141\u8bb8\u7279\u5b9a\u7aef\u53e3\u8bbf\u95ee&#xff1a;<span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">40131<\/span>\/tcp<br \/>\n<span class=\"token function\">sudo<\/span> ufw <span class=\"token builtin class-name\">enable<\/span>\n <\/li>\n<li>\u4f7f\u7528fail2ban\u9632\u6b62\u66b4\u529b\u7834\u89e3&#xff1a;<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> -y fail2ban<br \/>\n<span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> fail2ban<br \/>\n<span class=\"token function\">sudo<\/span> systemctl start fail2ban\n <\/li>\n<li>\u9650\u5236SSH\u8bbf\u95eeIP\u8303\u56f4&#xff08;\u5982\u679c\u6709\u56fa\u5b9aIP&#xff09;&#xff1a;<span class=\"token function\">sudo<\/span> ufw allow from <span class=\"token number\">192.168<\/span>.1.0\/24 to any port <span class=\"token number\">40131<\/span> proto tcp\n <\/li>\n<\/ul>\n<h4>5. \u5b9a\u671f\u5b89\u5168\u68c0\u67e5&#xff1a;\u9632\u60a3\u4e8e\u672a\u7136<\/h4>\n<ul>\n<li>\u6bcf\u6708\u68c0\u67e5\u4e00\u6b21SSH\u767b\u5f55\u65e5\u5fd7&#xff0c;\u67e5\u770b\u5f02\u5e38\u767b\u5f55\u5c1d\u8bd5&#xff1a;<span class=\"token function\">sudo<\/span> journalctl -u sshd &#8211;since <span class=\"token string\">&#034;1 month ago&#034;<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token string\">&#034;Failed password&#034;<\/span>\n <\/li>\n<li>\u6bcf\u5b63\u5ea6\u66f4\u6362\u4e00\u6b21\u5bc6\u94a5\u5bf9&#xff0c;\u5c24\u5176\u662f\u751f\u4ea7\u73af\u5883\u7684\u5bc6\u94a5<\/li>\n<li>\u670d\u52a1\u5668\u91cd\u542f\u540e\u9a8c\u8bc1\u514d\u5bc6\u767b\u5f55\u662f\u5426\u6b63\u5e38<\/li>\n<li>\u5b9a\u671f\u66f4\u65b0\u7cfb\u7edf\u548cSSH\u8f6f\u4ef6&#xff1a;sudo apt update &amp;&amp; sudo apt upgrade -y<\/li>\n<li>\u4f7f\u7528\u5b89\u5168\u626b\u63cf\u5de5\u5177\u68c0\u67e5SSH\u914d\u7f6e&#xff1a;ssh-audit 192.168.1.100:40131<\/li>\n<li>\u5b9a\u671f\u68c0\u67e5\u7528\u6237\u8d26\u6237&#xff0c;\u79fb\u9664\u4e0d\u518d\u9700\u8981\u7684\u8d26\u6237<\/li>\n<\/ul>\n<p>\u6211\u7684\u5b89\u5168\u52a0\u56fa\u4e60\u60ef&#xff1a;<\/p>\n<ul>\n<li>\u65b0\u670d\u52a1\u5668\u642d\u5efa\u5b8c\u6210\u540e&#xff0c;\u6211\u4f1a\u7acb\u5373\u6267\u884c\u5b89\u5168\u52a0\u56fa\u811a\u672c<\/li>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u4f7f\u7528ssh-audit\u5de5\u5177\u68c0\u67e5SSH\u5b89\u5168\u914d\u7f6e<\/li>\n<li>\u6bcf\u6708\u6267\u884c\u4e00\u6b21\u5168\u9762\u7684\u5b89\u5168\u5ba1\u8ba1&#xff0c;\u5305\u62ec\u65e5\u5fd7\u68c0\u67e5\u3001\u6f0f\u6d1e\u626b\u63cf\u7b49<\/li>\n<li>\u5efa\u7acb\u5b89\u5168\u4e8b\u4ef6\u54cd\u5e94\u673a\u5236&#xff0c;\u786e\u4fdd\u5728\u53d1\u751f\u5b89\u5168\u95ee\u9898\u65f6\u80fd\u5feb\u901f\u5904\u7406<\/li>\n<\/ul>\n<p>\u5b89\u5168\u662f\u6301\u7eed\u7684\u8fc7\u7a0b&#xff1a;<\/p>\n<ul>\n<li>\u5b89\u5168\u4e0d\u662f\u4e00\u6b21\u6027\u7684\u914d\u7f6e&#xff0c;\u800c\u662f\u6301\u7eed\u7684\u8fc7\u7a0b<\/li>\n<li>\u8981\u5b9a\u671f\u5173\u6ce8\u5b89\u5168\u6f0f\u6d1e\u516c\u544a&#xff0c;\u53ca\u65f6\u66f4\u65b0\u7cfb\u7edf\u548c\u8f6f\u4ef6<\/li>\n<li>\u4e0d\u65ad\u5b66\u4e60\u65b0\u7684\u5b89\u5168\u6280\u672f\u548c\u6700\u4f73\u5b9e\u8df5<\/li>\n<li>\u5efa\u7acb\u5b8c\u5584\u7684\u5b89\u5168\u7ba1\u7406\u5236\u5ea6&#xff0c;\u786e\u4fdd\u6240\u6709\u8fd0\u7ef4\u4eba\u5458\u90fd\u9075\u5b88\u5b89\u5168\u89c4\u8303<\/li>\n<\/ul>\n<h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u6392\u67e5&#xff1a;\u6211\u7684\u771f\u5b9e\u8e29\u5751\u8bb0\u5f55<\/h3>\n<p>\u5728\u591a\u5e74\u7684\u8fd0\u7ef4\u5de5\u4f5c\u4e2d&#xff0c;\u6211\u9047\u5230\u8fc7\u5404\u79cd\u5404\u6837\u7684SSH\u548csudo\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u7684\u6392\u67e5\u65b9\u6cd5\u548c\u6211\u7684\u771f\u5b9e\u89e3\u51b3\u6848\u4f8b&#xff1a;<\/p>\n<h4>1. SSH\u5bc6\u94a5\u8ba4\u8bc1\u5931\u8d25&#xff1a;\u6743\u9650\u95ee\u9898\u662f\u6700\u5e38\u89c1\u7684<\/h4>\n<p>\u53ef\u80fd\u539f\u56e0&#xff1a;<\/p>\n<ul>\n<li>\u5bc6\u94a5\u6587\u4ef6\u6743\u9650\u4e0d\u6b63\u786e&#xff08;\u6700\u5e38\u89c1&#xff09;<\/li>\n<li>\u516c\u94a5\u6ca1\u6709\u6b63\u786e\u6dfb\u52a0\u5230authorized_keys<\/li>\n<li>SSH\u670d\u52a1\u914d\u7f6e\u9650\u5236\u4e86\u5bc6\u94a5\u8ba4\u8bc1<\/li>\n<li>\u5ba2\u6237\u7aef\u5bc6\u94a5\u4e0e\u670d\u52a1\u5668\u516c\u94a5\u4e0d\u5339\u914d<\/li>\n<li>SELinux\u6216AppArmor\u7b49\u5b89\u5168\u6a21\u5757\u9650\u5236<\/li>\n<\/ul>\n<p>\u6211\u7684\u771f\u5b9e\u6848\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\u95ee\u9898&#xff1a;\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u4ecd\u7136\u9700\u8981\u8f93\u5165\u5bc6\u7801\u767b\u5f55<\/li>\n<li>\u6392\u67e5\u8fc7\u7a0b&#xff1a;\n<li>\u6267\u884cssh -v ubuntu-test\u67e5\u770b\u8be6\u7ec6\u8ba4\u8bc1\u8fc7\u7a0b&#xff0c;\u53d1\u73b0Offering public key: ~\/.ssh\/id_rsa_ubuntu_test RSA SHA256:&#8230;&#xff0c;\u4f46\u670d\u52a1\u5668\u8fd4\u56deAuthentications that can continue: password<\/li>\n<li>\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7&#xff1a;sudo journalctl -u sshd | grep &#034;Authentication refused&#034;&#xff0c;\u53d1\u73b0Authentication refused: bad ownership or modes for file \/home\/user\/.ssh\/authorized_keys<\/li>\n<li>\u68c0\u67e5\u6743\u9650&#xff1a;ssh ubuntu-test &#039;ls -la ~\/.ssh\/authorized_keys&#039;&#xff0c;\u53d1\u73b0\u6743\u9650\u662f644&#xff0c;\u4e0d\u7b26\u5408SSH\u8981\u6c42<\/li>\n<li>\u4fee\u590d\u6743\u9650&#xff1a;ssh ubuntu-test &#039;chmod 600 ~\/.ssh\/authorized_keys&#039;<\/li>\n<\/li>\n<li>\u7ed3\u679c&#xff1a;\u95ee\u9898\u89e3\u51b3&#xff0c;\u6210\u529f\u5b9e\u73b0\u514d\u5bc6\u767b\u5f55<\/li>\n<\/ul>\n<p>\u6392\u67e5\u6b65\u9aa4\u603b\u7ed3&#xff1a;<\/p>\n<li>\u7528ssh -v ubuntu-test\u67e5\u770b\u8be6\u7ec6\u8ba4\u8bc1\u8fc7\u7a0b<\/li>\n<li>\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7&#xff1a;sudo journalctl -u sshd | grep &#034;Authentication&#034;<\/li>\n<li>\u9a8c\u8bc1\u5bc6\u94a5\u6307\u7eb9&#xff1a;ssh-keygen -l -f ~\/.ssh\/id_rsa_ubuntu_test<\/li>\n<li>\u68c0\u67e5\u670d\u52a1\u5668authorized_keys&#xff1a;ssh ubuntu-test &#039;cat ~\/.ssh\/authorized_keys&#039;<\/li>\n<li>\u68c0\u67e5\u6743\u9650\u8bbe\u7f6e&#xff1a;ssh ubuntu-test &#039;ls -la ~ ~\/.ssh ~\/.ssh\/authorized_keys&#039;<\/li>\n<li>\u68c0\u67e5SSH\u670d\u52a1\u914d\u7f6e&#xff1a;ssh ubuntu-test &#039;sudo grep -i &#034;PubkeyAuthentication&#034; \/etc\/ssh\/sshd_config&#039;<\/li>\n<h4>2. sudo\u514d\u5bc6\u5931\u6548&#xff1a;\u914d\u7f6e\u6587\u4ef6\u548c\u6743\u9650\u662f\u5173\u952e<\/h4>\n<p>\u53ef\u80fd\u539f\u56e0&#xff1a;<\/p>\n<ul>\n<li>sudoers\u914d\u7f6e\u6587\u4ef6\u6743\u9650\u4e0d\u6b63\u786e<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u9519\u8bef<\/li>\n<li>\u7cfb\u7edf\u5b89\u5168\u7b56\u7565\u9650\u5236<\/li>\n<li>sudoers\u6587\u4ef6\u88ab\u5176\u4ed6\u89c4\u5219\u8986\u76d6<\/li>\n<\/ul>\n<p>\u6211\u7684\u771f\u5b9e\u6848\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\u95ee\u9898&#xff1a;\u914d\u7f6e\u4e86sudo\u514d\u5bc6&#xff0c;\u4f46\u6267\u884csudo\u547d\u4ee4\u65f6\u4ecd\u7136\u9700\u8981\u8f93\u5165\u5bc6\u7801<\/li>\n<li>\u6392\u67e5\u8fc7\u7a0b&#xff1a;\n<li>\u68c0\u67e5sudoers\u914d\u7f6e\u8bed\u6cd5&#xff1a;ssh ubuntu-test &#039;sudo visudo -c&#039;&#xff0c;\u7ed3\u679c\u663e\u793a\/etc\/sudoers: parsed OK<\/li>\n<li>\u9a8c\u8bc1\u7528\u6237\u6743\u9650&#xff1a;ssh ubuntu-test &#039;sudo -l -U user&#039;&#xff0c;\u53d1\u73b0\u8f93\u51fa\u4e2d\u6ca1\u6709NOPASSWD:\u6807\u8bb0<\/li>\n<li>\u68c0\u67e5sudoers.d\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u914d\u7f6e\u6587\u4ef6&#xff1a;ssh ubuntu-test &#039;ls -la \/etc\/sudoers.d\/&#039;&#xff0c;\u53d1\u73b0\u6709\u4e00\u4e2a00-defaults\u6587\u4ef6<\/li>\n<li>\u67e5\u770b\u8be5\u6587\u4ef6\u5185\u5bb9&#xff1a;ssh ubuntu-test &#039;cat \/etc\/sudoers.d\/00-defaults&#039;&#xff0c;\u53d1\u73b0\u5176\u4e2d\u6709Defaults env_reset\u548cDefaults mail_badpass&#xff0c;\u4f46\u6ca1\u6709\u6211\u7684\u914d\u7f6e<\/li>\n<li>\u68c0\u67e5\u6211\u7684\u914d\u7f6e\u6587\u4ef6\u6743\u9650&#xff1a;ssh ubuntu-test &#039;ls -la \/etc\/sudoers.d\/user&#039;&#xff0c;\u53d1\u73b0\u6743\u9650\u662f644&#xff0c;\u800c\u6b63\u786e\u7684\u6743\u9650\u5e94\u8be5\u662f440<\/li>\n<li>\u4fee\u590d\u6743\u9650&#xff1a;ssh ubuntu-test &#039;sudo chmod 440 \/etc\/sudoers.d\/user&#039;<\/li>\n<\/li>\n<li>\u7ed3\u679c&#xff1a;\u95ee\u9898\u89e3\u51b3&#xff0c;sudo\u547d\u4ee4\u4e0d\u518d\u9700\u8981\u8f93\u5165\u5bc6\u7801<\/li>\n<\/ul>\n<p>\u6392\u67e5\u6b65\u9aa4\u603b\u7ed3&#xff1a;<\/p>\n<li>\u68c0\u67e5sudoers\u914d\u7f6e\u8bed\u6cd5&#xff1a;sudo visudo -c<\/li>\n<li>\u9a8c\u8bc1\u7528\u6237\u6743\u9650&#xff1a;sudo -l -U user<\/li>\n<li>\u68c0\u67e5sudo\u65e5\u5fd7&#xff1a;sudo journalctl -t sudo | grep user<\/li>\n<li>\u68c0\u67e5sudoers.d\u76ee\u5f55\u4e0b\u6240\u6709\u914d\u7f6e\u6587\u4ef6&#xff1a;ls -la \/etc\/sudoers.d\/<\/li>\n<li>\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u6743\u9650&#xff1a;ls -la \/etc\/sudoers.d\/user&#xff0c;\u786e\u4fdd\u6743\u9650\u662f440<\/li>\n<li>\u67e5\u770bsudoers\u4e3b\u6587\u4ef6&#xff0c;\u786e\u8ba4\u662f\u5426\u5305\u542bsudoers.d\u76ee\u5f55&#xff1a;grep -i &#034;includedir&#034; \/etc\/sudoers<\/li>\n<h4>3. SSH\u8fde\u63a5\u8d85\u65f6&#xff1a;\u7f51\u7edc\u548c\u914d\u7f6e\u95ee\u9898<\/h4>\n<p>\u53ef\u80fd\u539f\u56e0&#xff1a;<\/p>\n<ul>\n<li>\u7f51\u7edc\u8fde\u63a5\u4e0d\u7a33\u5b9a<\/li>\n<li>SSH\u670d\u52a1\u5668\u914d\u7f6e\u4e86\u8f83\u77ed\u7684\u8d85\u65f6\u65f6\u95f4<\/li>\n<li>\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5b58\u5728\u9632\u706b\u5899\u6216\u4ee3\u7406<\/li>\n<li>SSH\u670d\u52a1\u672a\u542f\u52a8\u6216\u7aef\u53e3\u672a\u5f00\u653e<\/li>\n<\/ul>\n<p>\u6211\u7684\u771f\u5b9e\u6848\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\u95ee\u9898&#xff1a;SSH\u8fde\u63a5\u7ecf\u5e38\u5728\u7a7a\u95f2\u4e00\u6bb5\u65f6\u95f4\u540e\u65ad\u5f00<\/li>\n<li>\u89e3\u51b3\u65b9\u6cd5&#xff1a;\n<li>\u5728SSH Config\u4e2d\u6dfb\u52a0\u5fc3\u8df3\u5305\u914d\u7f6e&#xff08;\u5982\u524d\u9762\u6240\u793a&#xff09;<\/li>\n<li>\u670d\u52a1\u5668\u7aef\u914d\u7f6e&#xff1a;sudo sed -i &#039;s\/#ClientAliveInterval 0\/ClientAliveInterval 60\/&#039; \/etc\/ssh\/sshd_config<\/li>\n<li>\u91cd\u542fSSH\u670d\u52a1&#xff1a;sudo systemctl restart sshd<\/li>\n<\/li>\n<li>\u7ed3\u679c&#xff1a;\u8fde\u63a5\u8d85\u65f6\u95ee\u9898\u89e3\u51b3&#xff0c;\u957f\u65f6\u95f4\u7a7a\u95f2\u4e5f\u4e0d\u4f1a\u65ad\u5f00<\/li>\n<\/ul>\n<h4>4. \u516c\u94a5\u6dfb\u52a0\u5931\u8d25&#xff1a;\u6743\u9650\u548c\u8def\u5f84\u95ee\u9898<\/h4>\n<p>\u53ef\u80fd\u539f\u56e0&#xff1a;<\/p>\n<ul>\n<li>\u76ee\u6807\u670d\u52a1\u5668\u4e0d\u5b58\u5728~\/.ssh\u76ee\u5f55<\/li>\n<li>\u4e0a\u4f20\u516c\u94a5\u65f6\u6743\u9650\u4e0d\u8db3<\/li>\n<li>\u8def\u5f84\u9519\u8bef\u5bfc\u81f4\u516c\u94a5\u6587\u4ef6\u627e\u4e0d\u5230<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6cd5&#xff1a;<\/p>\n<ul>\n<li>\u786e\u4fdd~\/.ssh\u76ee\u5f55\u5b58\u5728&#xff1a;mkdir -p ~\/.ssh<\/li>\n<li>\u4f7f\u7528\u6b63\u786e\u7684\u6743\u9650\u521b\u5efa\u6587\u4ef6&#xff1a;cat \/tmp\/id_rsa.pub &gt;&gt; ~\/.ssh\/authorized_keys<\/li>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e\u7acb\u5373\u6e05\u7406\u4e34\u65f6\u6587\u4ef6&#xff1a;rm \/tmp\/id_rsa.pub<\/li>\n<\/ul>\n<p>\u6211\u7684\u6392\u67e5\u6280\u5de7&#xff1a;<\/p>\n<ul>\n<li>\u9047\u5230\u95ee\u9898\u65f6&#xff0c;\u5148\u68c0\u67e5\u6700\u57fa\u672c\u7684\u914d\u7f6e&#xff1a;\u6743\u9650\u3001\u8def\u5f84\u3001\u8bed\u6cd5<\/li>\n<li>\u4f7f\u7528\u8be6\u7ec6\u65e5\u5fd7\u548c\u8c03\u8bd5\u6a21\u5f0f\u5e2e\u52a9\u6392\u67e5<\/li>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u7acb\u5373\u8fdb\u884c\u5168\u9762\u6d4b\u8bd5<\/li>\n<li>\u517b\u6210\u8bb0\u5f55\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848\u7684\u4e60\u60ef&#xff0c;\u5efa\u7acb\u4e2a\u4eba\u8fd0\u7ef4\u77e5\u8bc6\u5e93<\/li>\n<\/ul>\n<h3>\u4e03\u3001\u603b\u7ed3\u4e0e\u53cd\u601d&#xff1a;\u4ece\u5b9e\u8df5\u4e2d\u83b7\u5f97\u7684\u8fd0\u7ef4\u667a\u6167<\/h3>\n<p>\u901a\u8fc7\u8fd9\u6b21\u5b9e\u8df5&#xff0c;\u6211\u6210\u529f\u914d\u7f6e\u4e86Ubuntu\u670d\u52a1\u5668\u7684\u514d\u5bc6\u767b\u5f55&#xff0c;\u5305\u62ec&#xff1a;<\/p>\n<li>\u2705 SSH\u5bc6\u94a5\u8ba4\u8bc1&#xff0c;\u65e0\u9700\u8f93\u5165\u5bc6\u7801&#xff0c;\u5927\u5e45\u63d0\u9ad8\u767b\u5f55\u6548\u7387<\/li>\n<li>\u2705 sudo\u514d\u5bc6\u7801&#xff0c;\u6267\u884c\u7279\u6743\u547d\u4ee4\u66f4\u9ad8\u6548&#xff0c;\u51cf\u5c11\u91cd\u590d\u64cd\u4f5c<\/li>\n<li>\u2705 SSH Config\u914d\u7f6e&#xff0c;\u7b80\u5316\u591a\u670d\u52a1\u5668\u7ba1\u7406&#xff0c;\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387<\/li>\n<li>\u2705 \u5168\u9762\u7684\u5b89\u5168\u52a0\u56fa&#xff0c;\u4fdd\u62a4\u7cfb\u7edf\u5b89\u5168&#xff0c;\u964d\u4f4e\u5b89\u5168\u98ce\u9669<\/li>\n<li>\u2705 \u7ed3\u5408AI\u5de5\u5177&#xff0c;\u63d0\u9ad8\u914d\u7f6e\u6548\u7387&#xff0c;\u51cf\u5c11\u4eba\u4e3a\u9519\u8bef<\/li>\n<p>\u6211\u7684\u53cd\u601d\u4e0e\u611f\u609f&#xff1a;<\/p>\n<ul>\n<li>\u514d\u5bc6\u767b\u5f55\u786e\u5b9e\u5927\u5927\u63d0\u9ad8\u4e86\u5de5\u4f5c\u6548\u7387&#xff0c;\u5c24\u5176\u9002\u5408\u9891\u7e41\u767b\u5f55\u670d\u52a1\u5668\u7684\u573a\u666f\u3002\u73b0\u5728\u6211\u6bcf\u5929\u767b\u5f55\u670d\u52a1\u5668\u7684\u65f6\u95f4\u51cf\u5c11\u4e8680%&#xff0c;\u6709\u66f4\u591a\u65f6\u95f4\u4e13\u6ce8\u4e8e\u6838\u5fc3\u4e1a\u52a1<\/li>\n<li>\u4f46\u5b89\u5168\u98ce\u9669\u4e5f\u968f\u4e4b\u589e\u52a0&#xff0c;\u5fc5\u987b\u505a\u597d\u5bc6\u94a5\u7ba1\u7406\u548c\u6743\u9650\u63a7\u5236\u3002\u5b89\u5168\u6c38\u8fdc\u662f\u8fd0\u7ef4\u5de5\u4f5c\u7684\u5e95\u7ebf&#xff0c;\u4e0d\u80fd\u4e3a\u4e86\u65b9\u4fbf\u800c\u5ffd\u89c6\u5b89\u5168<\/li>\n<li>AI\u5de5\u5177\u662f\u5f88\u597d\u7684\u8f85\u52a9&#xff0c;\u4f46\u4e0d\u80fd\u66ff\u4ee3\u5bf9\u6838\u5fc3\u539f\u7406\u7684\u7406\u89e3\u3002\u53ea\u6709\u7406\u89e3\u4e86\u6bcf\u4e2a\u6b65\u9aa4\u7684\u539f\u7406&#xff0c;\u624d\u80fd\u5728\u9047\u5230\u95ee\u9898\u65f6\u5feb\u901f\u5b9a\u4f4d\u548c\u89e3\u51b3<\/li>\n<li>\u5b9a\u671f\u7684\u5b89\u5168\u68c0\u67e5\u548c\u66f4\u65b0\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002\u5b89\u5168\u662f\u4e00\u4e2a\u6301\u7eed\u7684\u8fc7\u7a0b&#xff0c;\u4e0d\u662f\u4e00\u6b21\u6027\u7684\u914d\u7f6e<\/li>\n<li>\u7ec6\u8282\u51b3\u5b9a\u6210\u8d25\u3002SSH\u914d\u7f6e\u4e2d&#xff0c;\u6743\u9650\u8bbe\u7f6e\u3001\u8bed\u6cd5\u683c\u5f0f\u7b49\u7ec6\u8282\u95ee\u9898\u90fd\u53ef\u80fd\u5bfc\u81f4\u914d\u7f6e\u5931\u8d25<\/li>\n<li>\u826f\u597d\u7684\u4e60\u60ef\u5f88\u91cd\u8981\u3002\u5b9a\u671f\u5907\u4efd\u3001\u8bb0\u5f55\u95ee\u9898\u3001\u603b\u7ed3\u7ecf\u9a8c&#xff0c;\u8fd9\u4e9b\u4e60\u60ef\u80fd\u8ba9\u8fd0\u7ef4\u5de5\u4f5c\u66f4\u9ad8\u6548\u3001\u66f4\u53ef\u9760<\/li>\n<\/ul>\n<p>\u7ed9\u65b0\u624b\u768410\u6761\u5b9e\u7528\u5efa\u8bae&#xff1a;<\/p>\n<li>\u4ece\u5c0f\u89c4\u6a21\u6d4b\u8bd5\u5f00\u59cb&#xff0c;\u5148\u5728\u6d4b\u8bd5\u73af\u5883\u719f\u7ec3\u64cd\u4f5c&#xff0c;\u518d\u5e94\u7528\u5230\u751f\u4ea7\u73af\u5883<\/li>\n<li>\u6bcf\u4e00\u6b65\u914d\u7f6e\u90fd\u8981\u9a8c\u8bc1&#xff0c;\u786e\u4fdd\u914d\u7f6e\u751f\u6548\u540e\u518d\u8fdb\u884c\u4e0b\u4e00\u6b65<\/li>\n<li>\u517b\u6210\u826f\u597d\u7684\u5bc6\u94a5\u7ba1\u7406\u4e60\u60ef&#xff0c;\u4e3a\u4e0d\u540c\u73af\u5883\u4f7f\u7528\u4e0d\u540c\u5bc6\u94a5&#xff0c;\u5b9a\u671f\u66f4\u6362<\/li>\n<li>\u4e25\u683c\u9075\u5b88\u6743\u9650\u8bbe\u7f6e\u8981\u6c42&#xff0c;SSH\u5bf9\u6743\u9650\u8981\u6c42\u975e\u5e38\u4e25\u683c&#xff0c;\u8fd9\u662f\u5b89\u5168\u7684\u57fa\u7840<\/li>\n<li>\u914d\u7f6eSSH Config\u6587\u4ef6&#xff0c;\u7b80\u5316\u591a\u670d\u52a1\u5668\u7ba1\u7406&#xff0c;\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387<\/li>\n<li>\u4e0d\u8981\u76f4\u63a5\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6&#xff0c;\u4f7f\u7528\/etc\/sudoers.d\/\u76ee\u5f55\u66f4\u5b89\u5168<\/li>\n<li>\u5b9a\u671f\u68c0\u67e5\u5b89\u5168\u914d\u7f6e&#xff0c;\u5305\u62ec\u65e5\u5fd7\u5ba1\u8ba1\u3001\u6743\u9650\u68c0\u67e5\u3001\u8f6f\u4ef6\u66f4\u65b0<\/li>\n<li>\u5b66\u4f1a\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177&#xff0c;\u5982ssh -v\u3001journalctl\u7b49&#xff0c;\u5e2e\u52a9\u6392\u67e5\u95ee\u9898<\/li>\n<li>\u5efa\u7acb\u4e2a\u4eba\u8fd0\u7ef4\u77e5\u8bc6\u5e93&#xff0c;\u8bb0\u5f55\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848&#xff0c;\u65b9\u4fbf\u540e\u7eed\u53c2\u8003<\/li>\n<li>\u6301\u7eed\u5b66\u4e60\u5b89\u5168\u77e5\u8bc6&#xff0c;\u5173\u6ce8\u6700\u65b0\u7684\u5b89\u5168\u6f0f\u6d1e\u548c\u6700\u4f73\u5b9e\u8df5<\/li>\n<p>\u6700\u540e\u60f3\u8bf4\u7684\u8bdd&#xff1a;<\/p>\n<p>\u6280\u672f\u7684\u672c\u8d28\u662f\u63d0\u9ad8\u6548\u7387&#xff0c;\u4f46\u5b89\u5168\u6c38\u8fdc\u662f\u7b2c\u4e00\u4f4d\u7684\u3002\u5728\u8ffd\u6c42\u4fbf\u6377\u7684\u540c\u65f6&#xff0c;\u4e00\u5b9a\u8981\u505a\u597d\u5b89\u5168\u9632\u62a4\u3002SSH\u514d\u5bc6\u767b\u5f55\u770b\u4f3c\u7b80\u5355&#xff0c;\u4f46\u5176\u4e2d\u5305\u542b\u4e86\u5f88\u591a\u8fd0\u7ef4\u667a\u6167\u548c\u5b89\u5168\u8003\u91cf\u3002\u5e0c\u671b\u6211\u7684\u7ecf\u9a8c\u80fd\u5e2e\u52a9\u4f60\u5c11\u8e29\u5751&#xff0c;\u66f4\u9ad8\u6548\u3001\u66f4\u5b89\u5168\u5730\u7ba1\u7406\u670d\u52a1\u5668\u3002<\/p>\n<p>\u4f5c\u4e3a\u4e00\u540d\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u4eec\u7684\u5de5\u4f5c\u5c31\u662f\u5728\u4fbf\u6377\u6027\u548c\u5b89\u5168\u6027\u4e4b\u95f4\u627e\u5230\u5e73\u8861&#xff0c;\u4e3a\u4e1a\u52a1\u63d0\u4f9b\u53ef\u9760\u7684\u57fa\u7840\u8bbe\u65bd\u652f\u6301\u3002\u613f\u4f60\u5728\u8fd0\u7ef4\u4e4b\u8def\u4e0a\u4e0d\u65ad\u6210\u957f&#xff0c;\u6210\u4e3a\u4e00\u540d\u4f18\u79c0\u7684\u8fd0\u7ef4\u5de5\u7a0b\u5e08&#xff01;<\/p>\n<h3>\u53c2\u8003\u94fe\u63a5<\/h3>\n<ul>\n<li>SSH\u5bc6\u94a5\u767b\u5f55\u539f\u7406&#xff08;\u5b98\u65b9\u6587\u6863&#xff0c;\u975e\u5e38\u8be6\u7ec6&#xff09;<\/li>\n<li>sudo\u514d\u5bc6\u7801\u5b89\u5168\u914d\u7f6e&#xff08;Ubuntu\u5b98\u65b9\u6307\u5357&#xff09;<\/li>\n<li>SSH Config\u6700\u4f73\u5b9e\u8df5&#xff08;Linuxize\u7684\u8be6\u7ec6\u6559\u7a0b&#xff09;<\/li>\n<li>PostgreSQL 18\u5b89\u88c5\u6307\u5357&#xff08;PostgreSQL\u5b98\u65b9\u6587\u6863&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<p>\u4f5c\u8005&#xff1a;\u8fd0\u7ef4\u8001\u53f8\u673a \u53d1\u5e03\u65f6\u95f4&#xff1a;2025-12-18 \u9002\u7528\u4eba\u7fa4&#xff1a;\u5f00\u53d1\u4eba\u5458\u3001\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u3001\u670d\u52a1\u5668\u7ba1\u7406\u5458 \u6807\u7b7e&#xff1a;Ubuntu\u3001SSH\u3001\u514d\u5bc6\u767b\u5f55\u3001sudo\u3001\u670d\u52a1\u5668\u7ba1\u7406\u3001AI\u5de5\u5177<\/p>\n<hr \/>\n<p>\u6700\u540e\u8bf4\u4e00\u53e5&#xff1a;\u6280\u672f\u7684\u672c\u8d28\u662f\u63d0\u9ad8\u6548\u7387&#xff0c;\u4f46\u5b89\u5168\u6c38\u8fdc\u662f\u7b2c\u4e00\u4f4d\u7684\u3002\u5728\u8ffd\u6c42\u4fbf\u6377\u7684\u540c\u65f6&#xff0c;\u4e00\u5b9a\u8981\u505a\u597d\u5b89\u5168\u9632\u62a4&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5&#xff1a;\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5<br \/>\n\u5f15\u8a00<br \/>\n\u4f5c\u4e3a\u4e00\u540d\u5f00\u53d1\u517c\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u6bcf\u5929\u8981\u767b\u5f55\u81f3\u5c1110\u53f0\u670d\u52a1\u5668\u6267\u884c\u547d\u4ee4\u3001\u90e8\u7f72\u4ee3\u7801\u3001\u67e5\u770b\u65e5\u5fd7\u3002\u4ee5\u524d\u6bcf\u6b21\u767b\u5f55\u90fd\u8981\u8f93\u5165SSH\u5bc6\u7801&#xff0c;\u6267\u884csudo\u547d\u4ee4\u8fd8\u8981\u518d\u8f93\u4e00\u904d\u5bc6\u7801&#xff0c;\u4e00\u5929\u4e0b\u6765\u5149\u662f\u8f93\u5bc6\u7801\u90fd\u8981\u82b1\u4e0d\u5c11\u65f6\u95f4&#xff0c;\u6548\u7387\u4f4e\u5f97\u8ba9\u4eba\u5d29\u6e83\u3002\u8bb0\u5f97\u6709\u4e00\u6b21\u8d76\u9879\u76ee\u4e0a\u7ebf&#xff0c;\u6211\u57281\u5c0f\u65f6\u5185\u767b\u5f55\u4e868\u53f0\u670d\u52a1\u5668&#xff0c;\u8f93\u4e8616\u6b21\u5bc6\u7801&#xff0c;\u6700\u540e\u624b\u6307\u90fd\u9ebb\u6728\u4e86&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[103,50,43],"topic":[],"class_list":["post-86496","post","type-post","status-publish","format-standard","hentry","category-server","tag-ubuntu","tag-50","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/86496.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5&#xff1a;\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 \u5f15\u8a00 \u4f5c\u4e3a\u4e00\u540d\u5f00\u53d1\u517c\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u6bcf\u5929\u8981\u767b\u5f55\u81f3\u5c1110\u53f0\u670d\u52a1\u5668\u6267\u884c\u547d\u4ee4\u3001\u90e8\u7f72\u4ee3\u7801\u3001\u67e5\u770b\u65e5\u5fd7\u3002\u4ee5\u524d\u6bcf\u6b21\u767b\u5f55\u90fd\u8981\u8f93\u5165SSH\u5bc6\u7801&#xff0c;\u6267\u884csudo\u547d\u4ee4\u8fd8\u8981\u518d\u8f93\u4e00\u904d\u5bc6\u7801&#xff0c;\u4e00\u5929\u4e0b\u6765\u5149\u662f\u8f93\u5bc6\u7801\u90fd\u8981\u82b1\u4e0d\u5c11\u65f6\u95f4&#xff0c;\u6548\u7387\u4f4e\u5f97\u8ba9\u4eba\u5d29\u6e83\u3002\u8bb0\u5f97\u6709\u4e00\u6b21\u8d76\u9879\u76ee\u4e0a\u7ebf&#xff0c;\u6211\u57281\u5c0f\u65f6\u5185\u767b\u5f55\u4e868\u53f0\u670d\u52a1\u5668&#xff0c;\u8f93\u4e8616\u6b21\u5bc6\u7801&#xff0c;\u6700\u540e\u624b\u6307\u90fd\u9ebb\u6728\u4e86&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/86496.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-28T11:08:56+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/86496.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/86496.html\",\"name\":\"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-28T11:08:56+00:00\",\"dateModified\":\"2026-07-28T11:08:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/86496.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/86496.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/86496.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/86496.html","og_locale":"zh_CN","og_type":"article","og_title":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5&#xff1a;\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 \u5f15\u8a00 \u4f5c\u4e3a\u4e00\u540d\u5f00\u53d1\u517c\u8fd0\u7ef4\u4eba\u5458&#xff0c;\u6211\u6bcf\u5929\u8981\u767b\u5f55\u81f3\u5c1110\u53f0\u670d\u52a1\u5668\u6267\u884c\u547d\u4ee4\u3001\u90e8\u7f72\u4ee3\u7801\u3001\u67e5\u770b\u65e5\u5fd7\u3002\u4ee5\u524d\u6bcf\u6b21\u767b\u5f55\u90fd\u8981\u8f93\u5165SSH\u5bc6\u7801&#xff0c;\u6267\u884csudo\u547d\u4ee4\u8fd8\u8981\u518d\u8f93\u4e00\u904d\u5bc6\u7801&#xff0c;\u4e00\u5929\u4e0b\u6765\u5149\u662f\u8f93\u5bc6\u7801\u90fd\u8981\u82b1\u4e0d\u5c11\u65f6\u95f4&#xff0c;\u6548\u7387\u4f4e\u5f97\u8ba9\u4eba\u5d29\u6e83\u3002\u8bb0\u5f97\u6709\u4e00\u6b21\u8d76\u9879\u76ee\u4e0a\u7ebf&#xff0c;\u6211\u57281\u5c0f\u65f6\u5185\u767b\u5f55\u4e868\u53f0\u670d\u52a1\u5668&#xff0c;\u8f93\u4e8616\u6b21\u5bc6\u7801&#xff0c;\u6700\u540e\u624b\u6307\u90fd\u9ebb\u6728\u4e86&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/86496.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-28T11:08:56+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/86496.html","url":"https:\/\/www.wsisp.com\/helps\/86496.html","name":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-28T11:08:56+00:00","dateModified":"2026-07-28T11:08:56+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/86496.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/86496.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/86496.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Ubuntu\u670d\u52a1\u5668\u514d\u5bc6\u767b\u5f55\u8bbe\u7f6e\u4e0e\u6d4b\u8bd5\uff1a\u7ed3\u5408AI\u5de5\u5177\u7684\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/86496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=86496"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/86496\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=86496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=86496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=86496"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=86496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}