{"id":18323,"date":"2024-04-23T20:03:23","date_gmt":"2024-04-23T12:03:23","guid":{"rendered":"https:\/\/www.linuxcool.com\/jslczxtqdlc"},"modified":"2024-04-23T20:03:23","modified_gmt":"2024-04-23T12:03:23","slug":"jslczxtqdlc","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/jslczxtqdlc","title":{"rendered":"\u7b80\u8ff0Linux\u64cd\u4f5c\u7cfb\u7edf\u542f\u52a8\u6d41\u7a0b"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Contents<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>1.\u9610\u8ff0<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxprobe.com\/' target='_blank' rel=\"noopener\">Linux<\/a>\u64cd\u4f5c<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxdown.com\/' target='_blank' rel=\"noopener\">\u7cfb\u7edf<\/a>\u542f\u52a8\u6d41\u7a0b\uff08grub2\/systemd\uff09<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Linux\u64cd\u4f5c\u7cfb\u7edf\u542f\u52a8\u5f15\u5bfc\u7684\u8fc7\u7a0b<strong>linux\u91cd\u7f6e\u7cfb\u7edf\u76d8<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a><\/strong>\uff0c\u7cfb\u7edf\u7684\u63a7\u5236\u6743\u79fb\u4ea4\u5927\u81f4\u5206\u4e3a\u5982\u4e0b4\u6b65\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>BIOSPOST\uff0c\u53caBIOS\u52a0\u7535\u81ea\u68c0\u3002GRUB\u88c5\u8f7d\u8fa8\u8bc6\u5e76\u88c5\u8f7d\u5185\u6838\u3002\u5185\u6838\u8fa8\u8bc6\u6839\u6587\u4ef6\u7cfb\u7edf\u5e76\u542f\u52a8systemd\u3002systemd\u6253\u7b97\u7cfb\u7edf\u8d44\u6e90\uff0c\u6700\u7ec8\u5b8c\u6210\u7cfb\u7edf\u542f\u52a8\uff0c\u7cfb\u7edf\u5c31\u7eea\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u7b2c\u4e00\u6b65\u4e2d\uff0c\u4ece\u6309\u4e0b\u7535\u6e90\u952e\u663e\u5361BIOS\u5f00\u59cb\u52a0\u7535\u81ea\u68c0\uff08POST\uff0c\u5373Power-On-Self-Test\uff09\u5e76\u5b8c\u6210\u786c\u4ef6\u521d\u59cb\u5316\uff0c\u5047\u5982\u5728\u52a0\u7535\u81ea\u68c0\u9636\u6bb5\u5931\u8d25\uff0c\u5219\u672a\u80fd\u542f\u52a8\u7cfb\u7edf\uff0c\u542f\u52a8\u6d41\u7a0b\u4e0d\u4f1a\u5f80\u524d\u8fdb\u884c\uff1b\u5f53\u52a0\u7535\u81ea\u68c0\u548c\u786c\u4ef6\u521d\u59cb\u5316\u64cd\u4f5c\u5b8c\u6210\uff0cBIOS\u624d\u4f1a\u8bfb\u53d6\u53ef\u5f15\u5bfc\u8bbe\u5907\u7684\u7b2c\u4e00\u4e2a\u78c1\u9053\u4e2d\u7684\u4e3b\u5f15\u5bfc\u8bb0\u5f55\uff08MBR\uff09\uff0c\u4e4b\u540e\u4e3b\u5f15\u5bfc\u8bb0\u5f55\u4e2d\u7684\u5f15\u5bfc\u88c5\u8f7d\u5668\uff08GRUB\/GRUB2\uff09\u63a5\u7ba1\u6b64\u540e\u7684\u542f\u52a8\u6d41\u7a0b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728GRUB\u901a\u8fc7\u5728\u5176\u4e2d\u8bb0\u5f55\u7684\u4fdd\u5b58\u6709\/boot\u5206\u533a\u6587\u4ef6\u7cfb\u7edf\u9a71\u52a8\uff08\u4f8b\u5982\u652f\u6301EXT\u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\u3001FAT\u6587\u4ef6\u7cfb\u7edf\u3001NTFS\u6587\u4ef6\u7cfb\u7edf\uff09\uff0c\u81f3\u6b64\uff0c\u5c31\u53ef\u4ee5\u8fa8\u8bc6\/boot\u5206\u533a\u4e86\u3002\u63a5\u51fa\u6765\u901a\u8fc7\u5b9a\u4f4d\/boot\u5206\u533a\u4e2d\u7684vmlinuz\u5185\u6838\u6587\u4ef6\uff08\u81ea\u89e3\u538b\u6587\u4ef6\uff09\uff0c\u5c06\u5176\u88c5\u8f7d\u5230\u663e\u5b58\u4e2d\uff0c\u540c\u65f6\u5c06\u6b64\u540e\u7684\u542f\u52a8\u63a7\u5236\u6743\u79fb\u4ea4\u7ed9\u5185\u6838\u3002\u5728GRUB2\u539f\u5148\u7684\u7248\u672c\u4e2d\uff0cGRUB\u63a7\u5236\u9636\u6bb5\u53ef\u4ee5\u88ab\u7ec6\u5206\u4e3a3\u4e2a\u8fc7\u7a0b\uff08stage1,stage1.5,stage2\uff09\u3002GRUB2\u7684\u5b98\u65b9\u8bf4\u660e\u4e2d\u5176\u5b9e\u5e76\u6ca1\u6709\u7ec6\u5206\u76843\u4e2a\u9636\u6bb5\u7684\u8bf4\u660e\uff0c\u7136\u800c\u5b9e\u9645\u4f9d\u7136\u662f\u4f9d\u5faa\u7684\u8fd9\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>stage1\u9636\u6bb5<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e2a\u9636\u6bb5GRUB\u4f1a\u4f9d\u7167MBR\uff08\u7b2c\u4e00\u4e2a\u78c1\u9053\u7684\u524d446\u4e2a\u5b57\u8282\uff09\u4e2d\u8bb0\u5f55\u7684\u5185\u5bb9\u5b9a\u4f4d\u5230stage1.5\u9636\u6bb5\u7684\u5206\u533a\u4f4d\u7f6e\u3002\u800cstage1.5\u9636\u6bb5\u5750\u843dMBR\u4ee5\u540e\uff0c\u5230\u7b2c\u4e00\u4e2a\u5206\u533a\u4e4b\u524d\u7684\u8fd9\u5757\u533a\u57df\u4e2d\u3002MBR\u4e2d\u7684\u5185\u5bb9\u8bb0\u5f55\u7684\u5c31\u662f\u201c\/usr\/lib\/grub\/i386-pc\/boot.img\u201d\u7684\u5185\u5bb9\uff0c\u4f46\u5b9e\u9645\u67e5\u770b\u4e8c\u8005\u5185\u5bb9\u5e76\u4e0d\u5b8c\u5168\u4e00\u81f4\uff08\u5728446\u5b57\u8282\u4ee5\u540e\u662f64\u5b57\u8282\u7684\u5206\u533a\u8868\uff0c\u5171\u8bb0\u5f554\u4e2a\u5206\u533a\u8bb0\u5f55\uff0c\u6bcf\u4f4d\u5206\u533a\u8bb0\u5f55\u536016\u4e2a\u5b57\u8282\uff0c\u6700\u540e2\u4e2a\u5b57\u8282\u4e3aMBR\u7684\u56fa\u5b9a\u6807\u793a\uff0c\u4e3a55AA\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8e\u4e0a\u8ff0\u6587\u4ef6\u5185\u5bb9\u4e0eMBR\u7684\u5185\u5bb9\u5bf9\u6bd4\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -lh \/usr\/lib\/grub\/i386-pc\/boot.img<\/span>\n-rw-r--r--. <span class=\"token number\">1<\/span> root root <span class=\"token number\">512<\/span> Nov  <span class=\"token number\">9<\/span>  <span class=\"token number\">2018<\/span> \/usr\/lib\/grub\/i386-pc\/boot.img\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># hexdump -Cv -n 512 \/usr\/lib\/grub\/i386-pc\/boot.img<\/span>\n00000000  eb <span class=\"token number\">63<\/span> <span class=\"token number\">90<\/span> 00 00 00 00 00  00 00 00 00 00 00 00 00  <span class=\"token operator\">|<\/span>.c<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000050  00 00 00 00 00 00 00 00  00 00 00 <span class=\"token number\">80<\/span> 01 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000060  00 00 00 00 ff fa eb 05  f6 c2 <span class=\"token number\">80<\/span> <span class=\"token number\">74<\/span> 05 f6 c2 <span class=\"token number\">70<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.t<span class=\"token punctuation\">..<\/span>.p<span class=\"token operator\">|<\/span>\n00000070  <span class=\"token number\">74<\/span> 02 b2 <span class=\"token number\">80<\/span> ea <span class=\"token number\">79<\/span> 7c 00  00 <span class=\"token number\">31<\/span> c0 8e d8 8e d0 <span class=\"token function\">bc<\/span>  <span class=\"token operator\">|<\/span>t<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>y<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000080  00 <span class=\"token number\">20<\/span> fb a0 <span class=\"token number\">64<\/span> 7c 3c ff  <span class=\"token number\">74<\/span> 02 <span class=\"token number\">88<\/span> c2 <span class=\"token number\">52<\/span> be 05 7c  <span class=\"token operator\">|<\/span><span class=\"token builtin class-name\">.<\/span> <span class=\"token punctuation\">..<\/span>d<span class=\"token operator\">|<\/span><span class=\"token operator\">&lt;<\/span>.t<span class=\"token punctuation\">..<\/span>.R<span class=\"token punctuation\">..<\/span><span class=\"token operator\">||<\/span>\n00000090  b4 <span class=\"token number\">41<\/span> bb aa <span class=\"token number\">55<\/span> <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> 5a  <span class=\"token number\">52<\/span> <span class=\"token number\">72<\/span> 3d <span class=\"token number\">81<\/span> fb <span class=\"token number\">55<\/span> aa <span class=\"token number\">75<\/span>  <span class=\"token operator\">|<\/span>.A<span class=\"token punctuation\">..<\/span>U<span class=\"token punctuation\">..<\/span>ZRr<span class=\"token operator\">=<\/span><span class=\"token punctuation\">..<\/span>U.u<span class=\"token operator\">|<\/span>\n000000a0  <span class=\"token number\">37<\/span> <span class=\"token number\">83<\/span> e1 01 <span class=\"token number\">74<\/span> <span class=\"token number\">32<\/span> <span class=\"token number\">31<\/span> c0  <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 04 <span class=\"token number\">40<\/span> <span class=\"token number\">88<\/span> <span class=\"token number\">44<\/span> ff <span class=\"token number\">89<\/span>  <span class=\"token operator\">|<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">..<\/span>.t21<span class=\"token punctuation\">..<\/span>D.@.D<span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000000b0  <span class=\"token number\">44<\/span> 02 c7 04 <span class=\"token number\">10<\/span> 00 <span class=\"token number\">66<\/span> 8b  1e 5c 7c <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 5c 08 <span class=\"token number\">66<\/span>  <span class=\"token operator\">|<\/span>D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\"><\/span><span class=\"token operator\">|<\/span>f.<span class=\"token punctuation\"><\/span>.f<span class=\"token operator\">|<\/span>\n000000c0  8b 1e <span class=\"token number\">60<\/span> 7c <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 5c 0c  c7 <span class=\"token number\">44<\/span> 06 00 <span class=\"token number\">70<\/span> b4 <span class=\"token number\">42<\/span> <span class=\"token builtin class-name\">cd<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token variable\"><span class=\"token variable\">`<\/span><span class=\"token operator\">|<\/span>f.<span class=\"token punctuation\"><\/span><span class=\"token punctuation\">..<\/span>D<span class=\"token punctuation\">..<\/span>p.B.<span class=\"token operator\">|<\/span>\n000000d0  <span class=\"token number\">13<\/span> <span class=\"token number\">72<\/span> 05 bb 00 <span class=\"token number\">70<\/span> eb <span class=\"token number\">76<\/span>  b4 08 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">73<\/span> 0d 5a <span class=\"token number\">84<\/span>  <span class=\"token operator\">|<\/span>.r<span class=\"token punctuation\">..<\/span>.p.v<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>s.Z.<span class=\"token operator\">|<\/span>\n000000e0  d2 0f <span class=\"token number\">83<\/span> de 00 be <span class=\"token number\">85<\/span> 7d  e9 <span class=\"token number\">82<\/span> 00 <span class=\"token number\">66<\/span> 0f b6 c6 <span class=\"token number\">88<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000000f0  <span class=\"token number\">64<\/span> ff <span class=\"token number\">40<\/span> <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 04 0f  b6 d1 c1 e2 02 <span class=\"token number\">88<\/span> e8 <span class=\"token number\">88<\/span>  <span class=\"token operator\">|<\/span>d.@f.D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000100  f4 <span class=\"token number\">40<\/span> <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 08 0f b6 c2  c0 e8 02 <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 04 <span class=\"token number\">66<\/span> a1  <span class=\"token operator\">|<\/span>.@.D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span>f.<span class=\"token operator\">|<\/span>\n00000110  <span class=\"token number\">60<\/span> 7c <span class=\"token number\">66<\/span> 09 c0 <span class=\"token number\">75<\/span> 4e <span class=\"token number\">66<\/span>  a1 5c 7c <span class=\"token number\">66<\/span> <span class=\"token number\">31<\/span> d2 <span class=\"token number\">66<\/span> f7  <span class=\"token operator\">|<\/span><span class=\"token variable\">`<\/span><\/span><span class=\"token operator\">|<\/span>f<span class=\"token punctuation\">..<\/span>uNf.<span class=\"token punctuation\"><\/span><span class=\"token operator\">|<\/span>f1.f.<span class=\"token operator\">|<\/span>\n00000120  <span class=\"token number\">34<\/span> <span class=\"token number\">88<\/span> d1 <span class=\"token number\">31<\/span> d2 <span class=\"token number\">66<\/span> f7 <span class=\"token number\">74<\/span>  04 3b <span class=\"token number\">44<\/span> 08 7d <span class=\"token number\">37<\/span> fe c1  <span class=\"token operator\">|<\/span><span class=\"token number\">4<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span>.f.t.<span class=\"token punctuation\">;<\/span>D.<span class=\"token punctuation\">}<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000130  <span class=\"token number\">88<\/span> c5 <span class=\"token number\">30<\/span> c0 c1 e8 02 08  c1 <span class=\"token number\">88<\/span> d0 5a <span class=\"token number\">88<\/span> c6 bb 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>Z<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000140  <span class=\"token number\">70<\/span> 8e c3 <span class=\"token number\">31<\/span> db b8 01 02  <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">72<\/span> 1e 8c c3 <span class=\"token number\">60<\/span> 1e  <span class=\"token operator\">|<\/span>p<span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>r<span class=\"token punctuation\">..<\/span>.<span class=\"token variable\"><span class=\"token variable\">`<\/span><span class=\"token builtin class-name\">.<\/span><span class=\"token operator\">|<\/span>\n00000150  b9 00 01 8e db <span class=\"token number\">31<\/span> f6 bf  00 <span class=\"token number\">80<\/span> 8e c6 fc f3 a5 1f  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.1<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000160  <span class=\"token number\">61<\/span> ff <span class=\"token number\">26<\/span> 5a 7c be <span class=\"token number\">80<\/span> 7d  eb 03 be 8f 7d e8 <span class=\"token number\">34<\/span> 00  <span class=\"token operator\">|<\/span>a.<span class=\"token operator\">&amp;<\/span>Z<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span>.4.<span class=\"token operator\">|<\/span>\n00000170  be <span class=\"token number\">94<\/span> 7d e8 2e 00 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">18<\/span>  eb fe <span class=\"token number\">47<\/span> <span class=\"token number\">52<\/span> <span class=\"token number\">55<\/span> <span class=\"token number\">42<\/span> <span class=\"token number\">20<\/span> 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.GRUB <span class=\"token builtin class-name\">.<\/span><span class=\"token operator\">|<\/span>\n00000180  <span class=\"token number\">47<\/span> <span class=\"token number\">65<\/span> 6f 6d 00 <span class=\"token number\">48<\/span> <span class=\"token number\">61<\/span> <span class=\"token number\">72<\/span>  <span class=\"token number\">64<\/span> <span class=\"token number\">20<\/span> <span class=\"token number\">44<\/span> <span class=\"token number\">69<\/span> <span class=\"token number\">73<\/span> 6b 00 <span class=\"token number\">52<\/span>  <span class=\"token operator\">|<\/span>Geom.Hard Disk.R<span class=\"token operator\">|<\/span>\n00000190  <span class=\"token number\">65<\/span> <span class=\"token number\">61<\/span> <span class=\"token number\">64<\/span> 00 <span class=\"token number\">20<\/span> <span class=\"token number\">45<\/span> <span class=\"token number\">72<\/span> <span class=\"token number\">72<\/span>  6f <span class=\"token number\">72<\/span> 0d 0a 00 bb 01 00  <span class=\"token operator\">|<\/span>ead. Error<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000001a0  b4 0e <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">10<\/span> ac 3c 00 <span class=\"token number\">75<\/span>  f4 c3 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">&lt;<\/span>.u<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 <span class=\"token number\">24<\/span> <span class=\"token number\">12<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>$.<span class=\"token operator\">|<\/span>\n000001c0  0f 09 00 <span class=\"token number\">52<\/span> be bd 7d <span class=\"token number\">31<\/span>  c0 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">46<\/span> 8a 0c <span class=\"token number\">84<\/span> c9  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span>.R<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span>.F<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000001d0  <span class=\"token number\">75<\/span> 0f be da 7d e8 cc ff  eb <span class=\"token number\">96<\/span> <span class=\"token number\">46<\/span> 6c 6f <span class=\"token number\">70<\/span> <span class=\"token number\">70<\/span> <span class=\"token number\">79<\/span>  <span class=\"token operator\">|<\/span>u<span class=\"token punctuation\">..<\/span>.<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.Floppy<span class=\"token operator\">|<\/span>\n000001e0  00 bb 00 <span class=\"token number\">70<\/span> 8e c3 <span class=\"token number\">31<\/span> db  b8 01 02 b5 00 b6 00 <span class=\"token builtin class-name\">cd<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span>.p<span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span>\n000001f0  <span class=\"token number\">13<\/span> <span class=\"token number\">72<\/span> d4 b6 01 b5 4f e9  f1 fe 00 00 00 00 <span class=\"token number\">55<\/span> aa  <span class=\"token operator\">|<\/span>.r<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>O<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.U.<span class=\"token operator\">|<\/span>\n00000200\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n\u63a5\u4e0b\u6765\u67e5\u770b\u78c1\u76d8\u7684\u7b2c\u4e00\u4e2a\u6247\u533a\u7684\u5185\u5bb9\uff0c\u5373\u4e3b\u5f15\u5bfc\u8bb0\u5f55MBR\u7684\u5185\u5bb9\u3002\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># hexdump -Cv -n 512 \/dev\/vda<\/span>\n00000000  eb <span class=\"token number\">63<\/span> <span class=\"token number\">90<\/span> <span class=\"token number\">10<\/span> 8e d0 <span class=\"token function\">bc<\/span> 00  b0 b8 00 00 8e d8 8e c0  <span class=\"token operator\">|<\/span>.c<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000010  fb be 00 7c bf 00 06 b9  00 02 f3 a4 ea <span class=\"token number\">21<\/span> 06 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">!<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000020  00 be be 07 <span class=\"token number\">38<\/span> 04 <span class=\"token number\">75<\/span> 0b  <span class=\"token number\">83<\/span> c6 <span class=\"token number\">10<\/span> <span class=\"token number\">81<\/span> fe fe 07 <span class=\"token number\">75<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">8<\/span>.u<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>u<span class=\"token operator\">|<\/span>\n00000030  f3 eb <span class=\"token number\">16<\/span> b4 02 b0 01 bb  00 7c b2 <span class=\"token number\">80<\/span> 8a <span class=\"token number\">74<\/span> 01 8b  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span>.t<span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000040  4c 02 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> ea 00 7c 00  00 eb fe 00 00 00 00 00  <span class=\"token operator\">|<\/span>L<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span>\n00000050  00 00 00 00 00 00 00 00  00 00 00 <span class=\"token number\">80<\/span> 01 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000060  00 00 00 00 ff fa <span class=\"token number\">90<\/span> <span class=\"token number\">90<\/span>  f6 c2 <span class=\"token number\">80<\/span> <span class=\"token number\">74<\/span> 05 f6 c2 <span class=\"token number\">70<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.t<span class=\"token punctuation\">..<\/span>.p<span class=\"token operator\">|<\/span>\n00000070  <span class=\"token number\">74<\/span> 02 b2 <span class=\"token number\">80<\/span> ea <span class=\"token number\">79<\/span> 7c 00  00 <span class=\"token number\">31<\/span> c0 8e d8 8e d0 <span class=\"token function\">bc<\/span>  <span class=\"token operator\">|<\/span>t<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>y<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000080  00 <span class=\"token number\">20<\/span> fb a0 <span class=\"token number\">64<\/span> 7c 3c ff  <span class=\"token number\">74<\/span> 02 <span class=\"token number\">88<\/span> c2 <span class=\"token number\">52<\/span> be 05 7c  <span class=\"token operator\">|<\/span><span class=\"token builtin class-name\">.<\/span> <span class=\"token punctuation\">..<\/span>d<span class=\"token operator\">|<\/span><span class=\"token operator\">&lt;<\/span>.t<span class=\"token punctuation\">..<\/span>.R<span class=\"token punctuation\">..<\/span><span class=\"token operator\">||<\/span>\n00000090  b4 <span class=\"token number\">41<\/span> bb aa <span class=\"token number\">55<\/span> <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> 5a  <span class=\"token number\">52<\/span> <span class=\"token number\">72<\/span> 3d <span class=\"token number\">81<\/span> fb <span class=\"token number\">55<\/span> aa <span class=\"token number\">75<\/span>  <span class=\"token operator\">|<\/span>.A<span class=\"token punctuation\">..<\/span>U<span class=\"token punctuation\">..<\/span>ZRr<span class=\"token operator\">=<\/span><span class=\"token punctuation\">..<\/span>U.u<span class=\"token operator\">|<\/span>\n000000a0  <span class=\"token number\">37<\/span> <span class=\"token number\">83<\/span> e1 01 <span class=\"token number\">74<\/span> <span class=\"token number\">32<\/span> <span class=\"token number\">31<\/span> c0  <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 04 <span class=\"token number\">40<\/span> <span class=\"token number\">88<\/span> <span class=\"token number\">44<\/span> ff <span class=\"token number\">89<\/span>  <span class=\"token operator\">|<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">..<\/span>.t21<span class=\"token punctuation\">..<\/span>D.@.D<span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000000b0  <span class=\"token number\">44<\/span> 02 c7 04 <span class=\"token number\">10<\/span> 00 <span class=\"token number\">66<\/span> 8b  1e 5c 7c <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 5c 08 <span class=\"token number\">66<\/span>  <span class=\"token operator\">|<\/span>D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\"><\/span><span class=\"token operator\">|<\/span>f.<span class=\"token punctuation\"><\/span>.f<span class=\"token operator\">|<\/span>\n000000c0  8b 1e <span class=\"token number\">60<\/span> 7c <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 5c 0c  c7 <span class=\"token number\">44<\/span> 06 00 <span class=\"token number\">70<\/span> b4 <span class=\"token number\">42<\/span> <span class=\"token builtin class-name\">cd<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token variable\">`<\/span><\/span><span class=\"token operator\">|<\/span>f.<span class=\"token punctuation\"><\/span><span class=\"token punctuation\">..<\/span>D<span class=\"token punctuation\">..<\/span>p.B.<span class=\"token operator\">|<\/span>\n000000d0  <span class=\"token number\">13<\/span> <span class=\"token number\">72<\/span> 05 bb 00 <span class=\"token number\">70<\/span> eb <span class=\"token number\">76<\/span>  b4 08 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">73<\/span> 0d 5a <span class=\"token number\">84<\/span>  <span class=\"token operator\">|<\/span>.r<span class=\"token punctuation\">..<\/span>.p.v<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>s.Z.<span class=\"token operator\">|<\/span>\n000000e0  d2 0f <span class=\"token number\">83<\/span> de 00 be <span class=\"token number\">85<\/span> 7d  e9 <span class=\"token number\">82<\/span> 00 <span class=\"token number\">66<\/span> 0f b6 c6 <span class=\"token number\">88<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000000f0  <span class=\"token number\">64<\/span> ff <span class=\"token number\">40<\/span> <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 04 0f  b6 d1 c1 e2 02 <span class=\"token number\">88<\/span> e8 <span class=\"token number\">88<\/span>  <span class=\"token operator\">|<\/span>d.@f.D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000100  f4 <span class=\"token number\">40<\/span> <span class=\"token number\">89<\/span> <span class=\"token number\">44<\/span> 08 0f b6 c2  c0 e8 02 <span class=\"token number\">66<\/span> <span class=\"token number\">89<\/span> 04 <span class=\"token number\">66<\/span> a1  <span class=\"token operator\">|<\/span>.@.D<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.f<span class=\"token punctuation\">..<\/span>f.<span class=\"token operator\">|<\/span>\n00000110  <span class=\"token number\">60<\/span> 7c <span class=\"token number\">66<\/span> 09 c0 <span class=\"token number\">75<\/span> 4e <span class=\"token number\">66<\/span>  a1 5c 7c <span class=\"token number\">66<\/span> <span class=\"token number\">31<\/span> d2 <span class=\"token number\">66<\/span> f7  <span class=\"token operator\">|<\/span><span class=\"token variable\"><span class=\"token variable\">`<\/span><span class=\"token operator\">|<\/span>f<span class=\"token punctuation\">..<\/span>uNf.<span class=\"token punctuation\"><\/span><span class=\"token operator\">|<\/span>f1.f.<span class=\"token operator\">|<\/span>\n00000120  <span class=\"token number\">34<\/span> <span class=\"token number\">88<\/span> d1 <span class=\"token number\">31<\/span> d2 <span class=\"token number\">66<\/span> f7 <span class=\"token number\">74<\/span>  04 3b <span class=\"token number\">44<\/span> 08 7d <span class=\"token number\">37<\/span> fe c1  <span class=\"token operator\">|<\/span><span class=\"token number\">4<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span>.f.t.<span class=\"token punctuation\">;<\/span>D.<span class=\"token punctuation\">}<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000130  <span class=\"token number\">88<\/span> c5 <span class=\"token number\">30<\/span> c0 c1 e8 02 08  c1 <span class=\"token number\">88<\/span> d0 5a <span class=\"token number\">88<\/span> c6 bb 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>Z<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000140  <span class=\"token number\">70<\/span> 8e c3 <span class=\"token number\">31<\/span> db b8 01 02  <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">72<\/span> 1e 8c c3 <span class=\"token number\">60<\/span> 1e  <span class=\"token operator\">|<\/span>p<span class=\"token punctuation\">..<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>r<span class=\"token punctuation\">..<\/span>.<span class=\"token variable\">`<\/span><\/span><span class=\"token builtin class-name\">.<\/span><span class=\"token operator\">|<\/span>\n00000150  b9 00 01 8e db <span class=\"token number\">31<\/span> f6 bf  00 <span class=\"token number\">80<\/span> 8e c6 fc f3 a5 1f  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.1<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n00000160  <span class=\"token number\">61<\/span> ff <span class=\"token number\">26<\/span> 5a 7c be <span class=\"token number\">80<\/span> 7d  eb 03 be 8f 7d e8 <span class=\"token number\">34<\/span> 00  <span class=\"token operator\">|<\/span>a.<span class=\"token operator\">&amp;<\/span>Z<span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span>.4.<span class=\"token operator\">|<\/span>\n00000170  be <span class=\"token number\">94<\/span> 7d e8 2e 00 <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">18<\/span>  eb fe <span class=\"token number\">47<\/span> <span class=\"token number\">52<\/span> <span class=\"token number\">55<\/span> <span class=\"token number\">42<\/span> <span class=\"token number\">20<\/span> 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.GRUB <span class=\"token builtin class-name\">.<\/span><span class=\"token operator\">|<\/span>\n00000180  <span class=\"token number\">47<\/span> <span class=\"token number\">65<\/span> 6f 6d 00 <span class=\"token number\">48<\/span> <span class=\"token number\">61<\/span> <span class=\"token number\">72<\/span>  <span class=\"token number\">64<\/span> <span class=\"token number\">20<\/span> <span class=\"token number\">44<\/span> <span class=\"token number\">69<\/span> <span class=\"token number\">73<\/span> 6b 00 <span class=\"token number\">52<\/span>  <span class=\"token operator\">|<\/span>Geom.Hard Disk.R<span class=\"token operator\">|<\/span>\n00000190  <span class=\"token number\">65<\/span> <span class=\"token number\">61<\/span> <span class=\"token number\">64<\/span> 00 <span class=\"token number\">20<\/span> <span class=\"token number\">45<\/span> <span class=\"token number\">72<\/span> <span class=\"token number\">72<\/span>  6f <span class=\"token number\">72<\/span> 0d 0a 00 bb 01 00  <span class=\"token operator\">|<\/span>ead. Error<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000001a0  b4 0e <span class=\"token builtin class-name\">cd<\/span> <span class=\"token number\">10<\/span> ac 3c 00 <span class=\"token number\">75<\/span>  f4 c3 00 00 00 00 00 00  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">&lt;<\/span>.u<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token operator\">|<\/span>\n000001b0  00 00 00 00 00 00 00 00  e9 5f 09 00 00 00 <span class=\"token number\">80<\/span> <span class=\"token number\">20<\/span>  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>._<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>. <span class=\"token operator\">|<\/span>\n000001c0  <span class=\"token number\">21<\/span> 00 <span class=\"token number\">83<\/span> <span class=\"token number\">65<\/span> <span class=\"token number\">24<\/span> <span class=\"token number\">41<\/span> 00 08  00 00 00 00 <span class=\"token number\">10<\/span> 00 00 <span class=\"token number\">65<\/span>  <span class=\"token operator\">|<\/span><span class=\"token operator\">!<\/span><span class=\"token punctuation\">..<\/span>e<span class=\"token variable\">$A<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.e<span class=\"token operator\">|<\/span>\n000001d0  <span class=\"token number\">25<\/span> <span class=\"token number\">41<\/span> <span class=\"token number\">82<\/span> ef 2c c3 00 08  <span class=\"token number\">10<\/span> 00 00 00 <span class=\"token number\">20<\/span> 00 00 ef  <span class=\"token operator\">|<\/span>%A<span class=\"token punctuation\">..<\/span>,<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>. <span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span>\n000001e0  2d c3 8e fe ff ff 00 08  <span class=\"token number\">30<\/span> 00 00 f8 4f 02 00 00  <span class=\"token operator\">|<\/span>-<span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>.0<span class=\"token punctuation\">..<\/span>.O<span class=\"token punctuation\">..<\/span>.<span class=\"token operator\">|<\/span>\n000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 <span class=\"token number\">55<\/span> aa  <span class=\"token operator\">|<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span><span class=\"token punctuation\">..<\/span>U.<span class=\"token operator\">|<\/span>\n00000200\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>stage1.5<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e2a\u9636\u6bb5\u4e2d\u50a8\u5b58\u7684\u662fcore.img\u8fd9\u4e2a\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u901a\u7528\u6587\u4ef6\u7cfb\u7edf\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u4f8b\u5982EXT\u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\u3001FAT\u6587\u4ef6\u7cfb\u7edf\u3001NTFS\u6587\u4ef6\u7cfb\u7edf\u7b49\u3002\u901a\u8fc7\u5c06\u8fd9\u4e2a\u9636\u6bb5\u7684core.img\u88c5\u8f7d\u5230\u663e\u5b58\u4e2d\uff0c\u5c31\u53ef\u4ee5\u8fa8\u8bc6\u5230\/boot\u5206\u533a\u7684\u6587\u4ef6\u7cfb\u7edf\u4e86\u3002\u56e0\u4e3acore.img\u4e2d\u4e00\u822c\u4e0d\u5305\u542blvm\u7684\u8f6f\u4ef6\u4ee5\u53ca\u76f8\u5e94\u7684\u9a71\u52a8\uff0c\u6240\u4ee5\/boot\u5206\u533a\u4e0d\u80fd\u5b89\u88c5\u5728lvm\u903b\u8f91\u5377\u4e0a\u3002\u53e6\u5916\uff0c\u4e5f\u4e0d\u80fd\u5c06\/boot\u5206\u533a\u4f4e\u683c\u4e3aXFS\u6587\u4ef6\u7cfb\u7edf\u3002\u8fd9\u4e2a\u9636\u6bb5\u6267\u884c\u5b8c\u6210\u4ee5\u540e\uff0c\u5c31\u53ef\u4ee5\u8fa8\u8bc6\u5230\/boot\u5206\u533a\u4e86\u3002stage2<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e2a\u9636\u6bb5\u4e2d\uff0cGRUB\u5c31\u53ef\u4ee5\u5b9a\u4f4d\u5e76\u5c31\u80fd\u8fa8\u8bc6\/boot\u5206\u533a\u4e86\uff0c\u6b64\u65f6\u5c31\u53ef\u4ee5\u5c06\/boot\u5206\u533a\u4e2d\u7684\u5185\u6838\u6587\u4ef6vmlinuz\u88c5\u5728\u5230\u663e\u5b58\u4e2d\uff0c\u540c\u65f6GRUB\u4f1a\u5c06\u542f\u52a8\u6d41\u7a0b\u63a7\u5236\u6743\u79fb\u4ea4\u7ed9\u5185\u6838\u3002\u56e0\u4e3a\u6b64\u65f6\uff0c\u5047\u82e5\u5c06\u6839\u6587\u4ef6\u7cfb\u7edf\u88c5\u5728lvm\u903b\u8f91\u5377\u4e0a\uff0c\u4f4e\u683c\u4e3aEXT\u4e4b\u5916\u7684\u5176\u4ed6\u6587\u4ef6\u7cfb\u7edf\uff0c\u8fd9\u4e48\u5185\u6838\u5728\u8fd9\u4e2a\u9636\u6bb5\u8fd8\u4e0d\u80fd\u8fa8\u8bc6\u6839\u5206\u533a\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u6b64\u65f6\u5c31\u987b\u8981\u5229\u7528\/boot\u5206\u533a\u4e2d\u7684initramfs\u663e\u5b58\u865a\u62df\u6839\u6587\u4ef6\u7cfb\u7edf\u4e2d\u4fdd\u5b58\u7684\u5bf9\u5e94\u9a71\u52a8\u4ee5\u53ca\u7a0b\u5e8f\u7ed3\u5408\u7cfb\u7edf\u50a8\u5b58\u8bbe\u5907\u6620\u5c04\u6587\u4ef6System.map\u8fa8\u8bc6\u6839\u5206\u533a\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u81f3\u6b64\uff0c\u5185\u6838\u5c31\u53ef\u4ee5\u88c5\u8f7dsystemd\u7a0b\u5e8f\uff0c\u5e76\u5c06\u6b64\u540e\u7684\u542f\u52a8\u63a7\u5236\u6743\u79fb\u4ea4\u7ed9systemd\u7a0b\u5e8f\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u8fc7\u7a0b\u6982\u62ec\u4e3a\u5982\u53f3\u56fe\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemd\u662f\u73b0\u4eca\u4e3b\u6d41\u53d1\u884c\u7248\u7684\u901a\u7528\u8d44\u6e90\u7ba1\u7406\u65b9\u6cd5\uff0csystemd\u662f\u6240\u6709\u5176\u4ed6\u8fdb\u7a0b\u7684\u6bcd\u8fdb\u7a0b\uff0c\u4e0d\u4ec5\u8fdb\u7a0b\u7ba1\u7406\u4e4b\u5916\uff0c\u8fd8\u652f\u6301\u597d\u591a\u5176\u4ed6\u8d44\u6e90\u7ba1\u7406\uff0c\u4f8b\u5982\u6302\u8f7d\u6587\u4ef6\u7cfb\u7edf\u3001\u542f\u52a8\u548c\u7ba1\u7406\u7cfb\u7edf\u670d\u52a1\u7b49\u7b49\u3002systemd\u63a5\u7ba1\u542f\u52a8\u6d41\u7a0b\u4ee5\u540e\uff0c\u9996\u5148\u4f1a\u901a\u8fc7\u5b9a\u4e49\/etc\/fstab\u6302\u5728\u6587\u4ef6\u7cfb\u7edf\uff0c\u6b64\u65f6\u5c31\u53ef\u4ee5\u8bbf\u95ee\u6839\u76ee\u5f55\u4e2d\u7684\/etc\/\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\u4e86\uff0c\u5305\u62ec\u5176\u81ea\u8eab\u7684\u914d\u7f6e\u6587\u4ef6\/etc\/systemd\/system\/default.target\uff0c\u8fd9\u4e2a\u6587\u4ef6\u51b3\u5b9a\u4e86\u7cfb\u7edf\u7684\u9ed8\u8ba4\u8fd0\u884c\u7ea7\u522b\uff0c\u8be5\u6587\u4ef6\u53ea\u662f\u4e00\u4e2a\u94fe\u63a5\u6587\u4ef6\uff0c\u5176\u94fe\u63a5\u5230\u7cfb\u7edf\u542f\u52a8\u4ee5\u540e\u7684\u76ee\u6807target\u4e0a\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll \/etc\/systemd\/system\/default.target<\/span>\nlrwxrwxrwx. <span class=\"token number\">1<\/span> root root <span class=\"token number\">37<\/span> Feb <span class=\"token number\">18<\/span>  <span class=\"token number\">2020<\/span> \/etc\/systemd\/system\/default.target -<span class=\"token operator\">&gt;<\/span> \/lib\/systemd\/system\/multi-user.target\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/etc\/systemd\/system\/default.target<\/span>\n<span class=\"token comment\">#  This file is part of systemd.<\/span>\n<span class=\"token comment\">#<\/span>\n<span class=\"token comment\">#  systemd is free software; you can redistribute it and\/or modify it <\/span>\n<span class=\"token comment\">#  under the terms of the GNU Lesser General Public License as published by <\/span>\n<span class=\"token comment\">#  the Free Software Foundation; either version 2.1 of the License, or <\/span>\n<span class=\"token comment\">#  (at your option) any later version.<\/span>\n<span class=\"token punctuation\">[<\/span>Unit<span class=\"token punctuation\">]<\/span>\n<span class=\"token assign-left variable\">Description<\/span><span class=\"token operator\">=<\/span>Multi-User System\n<span class=\"token assign-left variable\">Documentation<\/span><span class=\"token operator\">=<\/span>man:systemd.special<span class=\"token punctuation\">(<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">)<\/span>\n<span class=\"token assign-left variable\">Requires<\/span><span class=\"token operator\">=<\/span>basic.target\n<span class=\"token assign-left variable\">Conflicts<\/span><span class=\"token operator\">=<\/span>rescue.service rescue.target\n<span class=\"token assign-left variable\">After<\/span><span class=\"token operator\">=<\/span>basic.target rescue.service rescue.target\n<span class=\"token assign-left variable\">AllowIsolate<\/span><span class=\"token operator\">=<\/span>yes\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># <\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u5373\u4e3adefault.target\u7684\u5185\u5bb9\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>multi-user.target\u5bf9\u5e94SystemVinit\u4e2d\u7684\u8fd0\u884c\u7ea7\u522b\u4e3arunleve3\uff0c\u800cgraphical.target\u5219\u5bf9\u5e94\u4e8erunleve5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8e\u5404\u4e2a\u8fd0\u884c\u7ea7\u522b\uff0c\u6982\u62ec\u603b\u7ed3\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>SystemVRunlevelsystemdtargetsystemtargetaliasDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>halt.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Haltsthesystemwithoutpoweringitdown.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>poweroff.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel0.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Haltsthesystemandturnsthepoweroff.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>emergency.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Singleusermode.Noservicesarerunning;filesystemsarenotmounted.Thisisthemostbasiclevelofoperationwithonlyanemergencyshellrunningonthemainconsolefortheusertointeractwiththesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>rescue.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel1.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Abasesystemincludingmountingthefilesystemswithonlythemostbasicservicesrunningandarescueshellonthemainconsole.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel2.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Multiuser,withoutNFSbutallothernon-GUIservicesrunning.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>multi-user.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel3.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Allservicesrunningbutcommandlineinterface(CLI)only.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel4.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Unused.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>graphical.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel5.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>multi-userwithaGUI.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>reboot.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel6.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Reboot<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>default.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Thistargetisalwaysaliasedwithasymboliclinktoeithermulti-user.targetorgraphical.target.systemdalwaysusesthedefault.targettostartthesystem.Thedefault.targetshouldneverbealiasedtohalt.target,poweroff.target,orreboot.target.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemd\u63a5\u7ba1\u542f\u52a8\u6d41\u7a0b\u4ee5\u540e\u7684\u64cd\u4f5c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u56fe\u4e2d\u7684sysinit.target\u548cbasic.target\u53ef\u4ee5\u770b\u4f5c\u662f\u542f\u52a8\u8fc7\u7a0b\u4e2d\u7684\u68c0\u6d4b\u70b9\uff0c\u5373\u4f7fsystemd\u652f\u6301\u8d44\u6e90\u7684\u5e76\u884c\u542f\u52a8\uff0c\u5e76\u4e14\u603b\u4f1a\u6709\u4e00\u4e9b\u670d\u52a1\u548c\u8d44\u6e90\u5bf9\u8c61\u987b\u8981\u5728\u5176\u4ed6\u8d44\u6e90\u5bf9\u8c61\u4e4b\u524d\u542f\u52a8\u3002\u5f53sysinit.target\u6267\u884c\u5b8c\u6210\u4ee5\u540e\uff0c\u90fd\u4f1a\u6267\u884cbasic.target\u8fd9\u4e2a\u8d44\u6e90\uff0c\u5f53\u8fd9\u79cd\u5148\u51b3\u8d44\u6e90\u542f\u52a8\u5b8c\u6210\u4ee5\u540e\uff0c\u6700\u540e\u5c31\u662f\u542f\u52a8\u8fd0\u884c\u7ea7\u522b\u8d44\u6e90\u5bf9\u8c61\u5f00\u542f\u5bf9\u5e94\u7684\u7528\u6237\u63d2\u53e3\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5f53systemd\u5c06\u7cfb\u7edf\u8d44\u6e90\u6253\u7b97\u5b8c\u6210\uff0c\u64cd\u4f5c\u7cfb\u7edf\u5c31\u5b8c\u6210\u4e86\u542f\u52a8\u7684\u6574\u4e2a\u6d41\u7a0b\u3002\u6b64\u65f6\u7528\u6237\u5c31\u53ef\u4ee5\u767b\u5165\u7cfb\u7edf\u8fdb\u884c\u64cd\u4f5c\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.systemctl\u7ba1\u7406\u547d\u4ee4<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u540e\u9762\u5217\u4e3e\u4e86systemd\u7684\u51e0\u4e2a\u8fd0\u884c\u7ea7\u522b\uff0c\u7528\u4e8e\u6307\u5b9a\u4e0d\u540c\u7684\u7528\u6237\u64cd\u4f5c\u73af\u5883\u3002\u800csystemd\u4f5c\u4e3aSystemVinit\u811a\u672c\u548cUpstart\u7684\u4ee3\u66ff\u8005\uff0c\u5176\u5b58\u5728\u5c31\u662f\u7528\u4e8e\u7ba1\u7406\u7cfb\u7edf\u8d44\u6e90\u548c\u670d\u52a1\u3002\u5176\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7279\u70b9\uff0c\u4f8b\u5982\u7cfb\u7edf\u542f\u52a8\u9636\u6bb5\u7684\u670d\u52a1\u5e76\u884c\u542f\u52a8\u3001\u6309\u9700\u6fc0\u6d3b\u5fc5\u8981\u7684\u5b88\u62a4\u8fdb\u7a0b\u4ee5\u53ca\u57fa\u4e8e\u4f9d\u8d56\u5173\u7cfb\u7684\u670d\u52a1\u63a7\u5236\u903b\u8f91\u7b49\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.1.systemd\u7684unit\u4ecb\u7ecd<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemd\u4e2d\u5f15\u5165\u4e86\u5355\u5143\uff08unit\uff09\u7684\u6982\u5ff5\uff0c\u8fd9\u79cd\u5355\u5143\u6d89\u53ca\u5230\u7cfb\u7edf\u670d\u52a1\u3001\u76d1\u542c\u5957\u63a5\u5b57\u4ee5\u53ca\u5176\u4ed6init\u7cfb\u7edf\u76f8\u5173\u7684\u5bf9\u8c61\u3002\u8981\u67e5\u770b\u7cfb\u7edf\u4e0asystemd\u652f\u6301\u7684\u5355\u5143\u90fd\u6709\u4ec0\u4e48\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctl-thelp\u83b7\u5f97\u3002\u5728CentOS7.6\u4e0a\u670913\u4e2a\u5355\u5143\uff1b\u800c\u5728CentOS8.2\u4e0a\u5219\u964d\u4f4e\u5230\u4e8611\u4e2a\u3002\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/etc\/redhat-release <\/span>\nCentOS Linux release <span class=\"token number\">8.3<\/span>.2011\n<span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -t help<\/span>\nAvailable unit types:\n<span class=\"token function\">service<\/span>\nsocket\ntarget\ndevice\n<span class=\"token function\">mount<\/span>\nautomount\nswap\ntimer\npath\nslice\nscope\n<span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -t help | egrep -v unit | wc -l<\/span>\n<span class=\"token number\">11<\/span>\n<span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># <\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/etc\/redhat-release <\/span>\nCentOS Linux release <span class=\"token number\">7.6<\/span>.1810 <span class=\"token punctuation\">(<\/span>Core<span class=\"token punctuation\">)<\/span> \n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -t help | egrep -v unit<\/span>\n<span class=\"token function\">service<\/span>\nsocket\nbusname\ntarget\nsnapshot\ndevice\n<span class=\"token function\">mount<\/span>\nautomount\nswap\ntimer\npath\nslice\nscope\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -t help | egrep -v unit | wc -l<\/span>\n<span class=\"token number\">13<\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># <\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4ece\u4e0a\u8ff0\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0cCentOS8.x\u4e2d\u6bd4CentOS7.x\u4e2d\u5c11\u4e86snapshot\u4ee5\u53cabusname\u8fd9\u4e24\u4e2a\u5355\u5143\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8e\u5355\u5143\uff0c\u4e00\u4e9b\u7b80\u5355\u7684\u4ecb\u7ecd\u603b\u7ed3\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>UnitTypeFileExtensionDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Serviceunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Asystemservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Targetunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Agroupofsystemdunits.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Automountunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.automount<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2024\/04\/1713873802191_0.png' alt='linux\u91cd\u7f6e\u78c1\u76d8_linux\u91cd\u7f6e\u7cfb\u7edf\u76d8\u547d\u4ee4_linux\u7cfb\u7edf\u91cd\u7f6e' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Afilesystemautomountpoint.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Deviceunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.device<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Adevicefilerecognizedbythekernel.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Mountunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.mount<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Afilesystemmountpoint.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Pathunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.path<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Afileordirectoryinafilesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Scopeunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.scope<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Anexternallycreatedprocess.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Sliceunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.slice<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Agroupofhierarchicallyorganizedunitsthatmanagesystemprocesses.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Snapshotunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.snapshot<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Asavedstateofthesystemdmanager<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Socketunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.socket<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Aninter-processcommunicationsocket.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Swapunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.swap<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Aswapdeviceoraswapfile<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Timerunit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>.timer<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Asystemdtimer.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u662f\u4e00\u4e9b\u7c7b\u578b\u7684\u5355\u5143\u4ee5\u53ca\u5176\u6269\u5145\u540d\u3002\u90a3\u4e9b\u6587\u4ef6\u4e00\u822c\u50a8\u5b58\u5728\u4e00\u4e0b\u4e09\u4e2a\u5730\u65b9\uff0c\u5177\u4f53\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>DirectoryDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\/usr\/lib\/systemd\/system\/<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>SystemdunitfilesdistributedwithinstalledRPMpackages.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\/run\/systemd\/system\/<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Systemdunitfilescreatedatruntime.Thedirectorytakesprecedenceoverthedirectorywithinstalledserviceunitfiles.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\/etc\/systemd\/system<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Systemdunitfilescreatedbysystemctlenableaswellasunitfilesaddedforextendingaservice.Thisdirectorytakesprecedenceoverthedirectroywithruntimeunitfiles.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u4e09\u4e2a\u8def\u5f84\u4e2d\uff0c\u4e00\u822c\u5c06\u7528\u6237\u5b9a\u4e49\u7684\u5355\u5143\uff08unit\uff09\u653e\u7f6e\u5728\u7b2c\u4e00\u4e2a\u8def\u5f84\u4e2d\uff0c\u5373\/usr\/lib\/systemd\/system\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u800csystemd\u81ea\u8eab\u7684\u914d\u7f6e\u6587\u4ef6\u662f\/etc\/systemd\/system.conf\uff0c\u53ef\u4ee5\u901a\u8fc7\u66f4\u6539\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u6765\u8c03\u6574systemd\u7684\u884c\u4e3a\u3002\u4f8b\u5982\u9ed8\u8ba4\u7684\u8d85\u65f6\u4e0a\u9650\u662f90\u79d2\uff0c\u901a\u8fc7\u66f4\u6539\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u6570\u7ec4DefaultTimeoutStartSec\u53ef\u4ee5\u6539\u53d8systemd\u7684\u8d85\u65f6\u65f6\u95f4\u3002\u4f8b\u5982\u6539\u4e3aDefaultTimeoutStartSec=120\u3002\u5c31\u5c06\u8d85\u65f6\u503c\u66f4\u6539\u4e3a\u4e86120\u79d2\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.2.systemd\u7684\u4e3b\u8981\u7279\u70b9<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemd\u63d0\u4f9b\u7684\u4e3b\u8981\u7279\u70b9\u6982\u62ec\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.3.systemctl\u547d\u4ee4\u7ba1\u7406\u7cfb\u7edf\u670d\u52a1<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u56e0\u4e3asystemd\u662f\u5411\u4e0a\u517c\u5bb9SysVinit\u7684\u670d\u52a1\u7ba1\u7406\u811a\u672c\u7684\uff0c\u6240\u4ee5\u5728CentOS7.x\u4e2d\u4f9d\u7136\u53ef\u4ee5\u4f7f\u7528service\u547d\u4ee4\u4ee5\u53cachkconfig\u8fd9\u4e24\u4e2a\u547d\u4ee4\u5bf9\u670d\u52a1\u8fdb\u884c\u7ba1\u7406\u3002\u800csystemd\u63d0\u4f9b\u7684\u670d\u52a1\u7ba1\u7406\u547d\u4ee4\u5219\u662fsystemctl\u3002\u8fd9\u4e2a\u547d\u4ee4\u53ef\u4ee5\u5bf9.service\u7c7b\u578b\u7684unit\u6267\u884cstart,stop,restart,enable,disable\u7b49\u64cd\u4f5c\u3002\u5173\u4e8eservice\u4e0esystemctl\u547d\u4ee4\u7684\u5bf9\u6bd4\uff0c\u8be6\u89c1\u4e0b\u8868\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicesystemctlDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamestart<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlstartname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Startsaservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamestop<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlstopname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Stopsaservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamerestart<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlrestartname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Restartsaservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamecondrestart<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctltry-restartname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Restartsaserviceonlyifitisrunning.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamereload<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlreloadname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Reloadsconfiguration.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>servicenamestatus<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlstatusname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlis-activename.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Checksifaserviceisrunning.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>service--status-all<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctllist-units--typeservice--all<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Displaysthestatusofallservices.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u662fservice\u547d\u4ee4\u4e0esystemctl\u547d\u4ee4\u7684\u5bf9\u6bd4\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfig\u547d\u4ee4\u4e0esystemctl\u547d\u4ee4\u7684\u5bf9\u6bd4\u7ed3\u679c\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2024\/04\/1713873802191_1.jpg' alt='linux\u91cd\u7f6e\u78c1\u76d8_linux\u91cd\u7f6e\u7cfb\u7edf\u76d8\u547d\u4ee4_linux\u7cfb\u7edf\u91cd\u7f6e' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfigsystemctlDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfignameon<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlenablename.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Enablesaservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfignameoff<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctldisablename.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Disablesaservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfig--listname<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlstatusname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlis-enabledname.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Checksifaserviceisenabled.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfig--list<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctllist-unit-files--typeservice<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Listsallservicesandchecksiftheyareenabled.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfig--list<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctllist-dependencies--after<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Listsservicesthatareorderedtostartbeforethespecifiedunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>chkconfig--list<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctllist-dependencies--before<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Listsservicesthatareorderedtostartafterthespecifiedunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4f7f\u7528systemctl\u547d\u4ee4\u7ba1\u7406\u670d\u52a1\u7684\u65f6\u4faf\uff0c\u901a\u5e38\u4f1a\u5199\u4e0a.service\u8fd9\u4e2a\u540e\u7f00\uff0c\u7136\u800c\u56e0\u4e3a\u9ed8\u8ba4\u7684\u670d\u52a1\u90fd\u662f\u4ee5.service\u7ed3\u5c3e\uff0c\u6240\u4ee5\u8fd9\u4e2a\u540e\u7f00\u662f\u53ef\u4ee5\u7701\u7565\u7684\u3002\u6240\u4ee5\u6267\u884csystemctlstartnfs-server.service\u4e0esystemctlstartnfs-server\u7684\u7597\u6548\u662f\u76f8\u540c\u7684\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u53e6\u5916\uff0c\u53ef\u4ee5\u67e5\u770b\u67d0\u4e2a\u670d\u52a1\u7684\u8be6\u5c3d\u4fe1\u606f\uff0c\u6b64\u65f6\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlshowname.service\u5373\u53ef\u3002\u5047\u5982\u8981\u67e5\u770b\u67d0\u4e00\u9879\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528-pname\u8fdb\u884c\u6307\u5b9a\u3002\u4f8b\u5982systemctlshownfs-server.service-pNames\u5c31\u53ef\u4ee5\u67e5\u770bnfs-server.service\u8fd9\u4e2a\u670d\u52a1\u7684Names\u8fd9\u4e2a\u4fe1\u606f\uff0c\u5373\u8fd9\u4e2a\u670d\u52a1\u6709\u51e0\u4e2a\u540d\u5b50\uff0c\u662f\u5426\u6709\u522b\u79f0\u7684\u5b58\u5728\uff0c\u90fd\u53ef\u4ee5\u88ab\u5217\u4e0b\u6765\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u5217\u4e3e\u5f53\u524d\u7cfb\u7edf\u4e0b\u6240\u6709\u65e9\u5df2\u88c5\u8f7d\u7684\u670d\u52a1\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctllist-units--typeservice\u3002\u5bf9\u4e8e\u6bcf\u4e00\u4e2a.service\u7c7b\u578b\u7684unit\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u5176\u5b8c\u6574\u7684\u670d\u52a1\u540d\u79f0\uff08UNIT\uff09\u3001\u8be5\u670d\u52a1\u662f\u5426\u88ab\u88c5\u8f7d\uff08LOAD\uff09\u3001\u4ee5\u53ca\u5176\u4e2d\u7ea7\uff08ACTIVE\uff09\u548c\u4f4e\u7ea7\uff08SUB\uff09\u5355\u5143\u6587\u4ef6\u7684\u6fc0\u6d3b\u72b6\u6001\uff0c\u4ee5\u53ca\u8be5\u670d\u52a1\u7684\u77ed\u63cf\u8ff0\u4fe1\u606f\uff08DESCRIPTION\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0csystemctllist-units\u8fd9\u4e2a\u547d\u4ee4\u53ea\u663e\u793a\u6d3b\u52a8\u7684\u5355\u5143<strong>linux\u91cd\u7f6e\u7cfb\u7edf\u76d8\u547d\u4ee4<\/strong>\uff0c\u5047\u5982\u60f3\u8981\u67e5\u770b\u6240\u6709\u7684\u5355\u5143\uff0c\u800c\u4e0d\u7ba1\u5176\u662f\u5426\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u987b\u8981\u52a0\u4e0a-a\/--all\u8fd9\u4e2a\u9009\u9879\u3002\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctllist-units--typeservice--all\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u67e5\u770b\u7cfb\u7edf\u4e0a\u65e9\u5df2\u88ab\u4f7f\u80fd\u7684\u670d\u52a1\u5355\u5143\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctllist-unit-files--typeservice\u8fdb\u884c\u67e5\u770b\u3002\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u670d\u52a1\u5355\u5143\uff0c\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u670d\u52a1\u5355\u5143\u7684\u5b8c\u6574\u540d\u79f0\uff08UNITFILE\uff09\u3001\u8be5\u670d\u52a1\u5355\u5143\u662f\u5426\u5904\u4e8e\u4f7f\u80fd\u72b6\u6001\uff08STATE\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u67e5\u770b\u670d\u52a1\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlstatusname.service\u8fdb\u884c\u67e5\u770b\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\u6570\u7ec4\u5305\u62ec\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>FieldDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Loaded<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Informationwhethertheserviceunithasbeenloaded,theabsolutepathtotheunitfile,andanotewhethertheunitisenabled.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Active<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Informationwhethertheserviceunitisrunningfollowedbyatimestamp.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>MainPID<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ThePIDofthecorrespondingsystemservicefollowedbyitsname.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Status<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Additionalinformationaboutthecorrespondingsystemservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Process<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Additionalinformationaboutrelatedprocesses.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>CGroup<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>AdditionalinformationaboutrelatedControlGroups(cgroups).<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u9a8c\u8bc1\u670d\u52a1\u5355\u5143\u662f\u5426\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u6216\u5219\u8fd0\u884c\u72b6\u6001\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlis-activename.service\u8fdb\u884c\u67e5\u770b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u67e5\u770b\u67d0\u4e2a\u670d\u52a1\u5355\u5143\u662f\u5426\u65e9\u5df2\u88ab\u4f7f\u80fd\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlis-enabledname.service\u8fdb\u884c\u67e5\u770b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u76f8\u5173\u7684\u670d\u52a1\u5355\u5143\u5904\u4e8e\u8fd0\u884c\u72b6\u6001\u6216\u5219\u662f\u88ab\u4f7f\u80fd\u72b6\u6001\uff0c\u8fd9\u4e48\u8fd9\u4e24\u6761\u547d\u4ee4\u7684\u9000\u51fa\u72b6\u6001\u7801\u90fd\u662f0\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u67e5\u770b\u67d0\u4e2a\u670d\u52a1\u5355\u5143\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u4f8b\u5982\u67e5\u770b\u8be5\u670d\u52a1\u662f\u5728\u4ec0\u4e48\u670d\u52a1\u4ee5\u540e\u542f\u52a8\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctllist-dependencies--aftername.service\u8fdb\u884c\u67e5\u770b\uff0c\u6362\u53e5\u8bdd\u8bf4linux\u6e38\u620f\uff0c\u5c31\u662f\u8be5\u547d\u4ee4\u4f1a\u9012\u5f52\u5217\u4e3eAfter=\u8fd9\u4e2a\u4f9d\u8d56\u5173\u7cfb\u4e2d\u5217\u4e3e\u7684\u5355\u5143\uff08\u5373\u8be5\u670d\u52a1\u6240\u4f9d\u8d56\u7684\u670d\u52a1\uff09\uff1b\u5047\u5982\u8981\u67e5\u770b\u8be5\u670d\u52a1\u662f\u5728\u4ec0\u4e48\u670d\u52a1\u4e4b\u524d\u542f\u52a8\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctllist-dependencies--beforename.service\u8fdb\u884c\u67e5\u770b\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u9012\u5f52\u5217\u4e3eBefore=\u4e2d\u5217\u4e3e\u7684\u5355\u5143\uff08\u4e5f\u5c31\u662f\u4f9d\u8d56\u4e8e\u8be5\u670d\u52a1\u7684\u5355\u5143\u6709\u4ec0\u4e48\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u542f\u52a8\u4e00\u4e2a\u670d\u52a1\u5355\u5143\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlstartname.service\u8fdb\u884c\u67e5\u770b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u505c\u6b62\u4e00\u4e2a\u670d\u52a1\u5355\u5143\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlstopname.service\u8fdb\u884c\u67e5\u770b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u91cd\u542f\u4e00\u4e2a\u670d\u52a1\u5355\u5143\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlrestartname.service\u8fdb\u884c\u67e5\u770b\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u505c\u6b62\u6307\u5b9a\u7684\u670d\u52a1\u5355\u5143\uff0c\u4e4b\u540e\u7acb\u523b\u542f\u52a8\u8be5\u670d\u52a1\u5355\u5143\u3002\u91cd\u8981\u7684\u4e00\u70b9\u662f\uff0c\u5018\u82e5\u6307\u5b9a\u7684\u670d\u52a1\u5355\u5143\u6b64\u65f6\u5e76\u6ca1\u6709\u5904\u4e8e\u8fd0\u884c\u72b6\u6001\uff0c\u8fd9\u4e48\u8fd9\u4e2a\u91cd\u542f\u7684\u64cd\u4f5c\u4e5f\u4f1a\u542f\u52a8\u5b83\u3002\u82e5\u679c\u53ea\u60f3\u5bf9\u65e9\u5df2\u8fd0\u884c\u7684\u670d\u52a1\u5355\u5143\u6267\u884c\u91cd\u542f\u64cd\u4f5c\uff0c\u800c\u672a\u8fd0\u884c\u7684\u670d\u52a1\u5355\u5143\u5219\u4e0d\u6267\u884c\u91cd\u542f\u64cd\u4f5c\uff0c\u8fd9\u4e48\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctltry-restartname.service\u8fd9\u4e2a\u547d\u4ee4\u6765\u5b8c\u6210\u3002\u53e6\u5916\uff0c\u67d0\u7cfb\u670d\u52a1\u5bb9\u8bb8\u5728\u4e0d\u4e2d\u65ad\u670d\u52a1\u6267\u884c\u7684\u524d\u63d0\u4e0b\u91cd\u65b0\u88c5\u5728\u914d\u7f6e\u6587\u4ef6\uff0c\u5bf9\u4e8e\u8fd9\u79cd\u670d\u52a1\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlreloadname.service\u8fdb\u884c\u914d\u7f6e\u6587\u4ef6\u7684\u91cd\u65b0\u88c5\u8f7d\u3002\u5165\u679c\u6307\u5b9a\u7684\u670d\u52a1\u5355\u5143\u5e76\u4e0d\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\uff0c\u8fd9\u4e48\u8fd9\u4e2a\u547d\u4ee4\u6267\u884c\u7684\u65f6\u4faf\u4f1a\u88ab\u5ffd\u89c6\u6389\u3002\u82e5\u679c\u4e0d\u786e\u5b9a\u670d\u52a1\u662f\u5426\u652f\u6301reload\u64cd\u4f5c\uff0c\u8fd9\u4e48\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlreload-or-restartname.service\u8fdb\u884c\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\u6216\u5219\u91cd\u542f\u7684\u64cd\u4f5c\uff1b\u82e5\u679c\u53ea\u5e0c\u671b\u5bf9\u65e9\u5df2\u8fd0\u884c\u7684\u670d\u52a1\u6267\u884c\u91cd\u65b0\u88c5\u8f7d\u6216\u5219\u91cd\u542f\u7684\u64cd\u4f5c\uff0c\u8fd9\u4e48\u987b\u8981\u6267\u884csystemctlreload-or-try-restartname.service\u547d\u4ee4\u8fdb\u884c\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\u6216\u5219\u5bf9\u65e9\u5df2\u8fd0\u884c\u7684\u670d\u52a1\u5355\u5143\u8fdb\u884c\u91cd\u542f\u7684\u64cd\u4f5c\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u4f7f\u80fd\uff08\u5373\u8bbe\u7f6e\u5f00\u673a\u624b\u52a8\u8fd0\u884c\uff09\u670d\u52a1\u5355\u5143\uff0c\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlenablename.service\u6765\u5b8c\u6210\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5728\/etc\/systemd\/system\u76ee\u5f55\u4e2d\u521b\u5efa\u5bf9\u5e94\u670d\u52a1\u5355\u5143\u7684\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u3002\u5047\u5982\u60f3\u8981\u76f8\u5173\u670d\u52a1\u7684\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u88ab\u91cd\u65b0\u521b\u5efa\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlreenablename.service\u6765\u5b8c\u6210\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u9996\u5148\u7981\u7528\u6307\u5b9a\u7684\u670d\u52a1\uff08\u5373\u5220\u6389\u76f8\u5173\u670d\u52a1\u7684\u7b26\u53f7\u94fe\u63a5\uff0c\u4e4b\u540e\u518d\u91cd\u65b0\u521b\u5efa\u8be5\u94fe\u63a5\uff09\u3002\u5047\u5982\u5bf9\u4e8e\u672a\u8fd0\u884c\u7684\u670d\u52a1\u5355\u5143\uff0c\u5728\u4f7f\u80fd\u5176\u8fd0\u884c\u7684\u540c\u65f6\uff0c\u8ba9\u5176\u7acb\u523b\u8fd0\u884c\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlenable--nowname.service\uff0c\u8868\u793a\u8ba9\u8be5\u670d\u52a1\u5f00\u673a\u624b\u52a8\u8fd0\u884c\uff0c\u4f46\u662f\u73b0\u4eca\u7acb\u523b\u8fd0\u884c\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u7981\u7528\u6307\u5b9a\u7684\u670d\u52a1\uff08\u6b63\u5f0f\u5176\u8bbe\u7f6e\u4e3a\u5f00\u673a\u4e0d\u624b\u52a8\u8fd0\u884c\uff09\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctldisablename.service\u3002\u5047\u5982\u60f3\u8981\u4e25\u7981\u67d0\u4e2a\u670d\u52a1\u88ab\u81ea\u52a8\u542f\u52a8\u6216\u5219\u88ab\u5176\u4ed6\u670d\u52a1\u542f\u52a8\uff0c\u6b64\u65f6\u53ef\u4ee5\u5c06\u5176\u63a9\u85cf\u4e0a\u53bb\uff0c\u6267\u884c\u547d\u4ee4systemctlmaskname.service\u5373\u53ef\uff0c\u8fd9\u4e2a\u547d\u4ee4\u7684\u5b9e\u9645\u64cd\u4f5c\u5c31\u662f\/etc\/systemd\/system\/name.service\u521b\u5efa\u4e3a\/dev\/null\u7684\u8f6f\u94fe\u63a5\u3002\u6240\u4ee5\u8981\u5bb9\u8bb8\u6307\u5b9a\u7684\u670d\u52a1\u53ef\u4ee5\u88ab\u81ea\u52a8\u542f\u52a8\u6216\u5219\u88ab\u5176\u4ed6\u670d\u52a1\u542f\u52a8\uff0c\u8fd9\u4e48\u5c31\u987b\u8981\u5c06\u63a9\u85cf\u62c6\u6389\uff0c\u5373\u6267\u884c\u547d\u4ee4systemctlunmaskname.service\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.4.systemctl\u4e0etarget<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728RHEL\/CentOS7.x\u4e4b\u524d\u7684\u53d1\u884c\u7248\u4e2d\uff0c\u4f7f\u7528SysVinit\u4ee5\u53caUpstart\u5b9e\u73b0\u9884\u5b9a\u4e49\u7684\u8fd0\u884c\u7ea7\u522b\u6765\u6292\u53d1\u7279\u5b9a\u7684\u64cd\u4f5c\u6a21\u5f0f\uff0c\u5176RHEL\/CentOS5.x\u4f7f\u7528\u7684\u662fSysVinit\uff0c\u5728RHEL\/CentOS6.x\u4e2d\u4f7f\u7528\u7684\u5219\u662fUpstart\u3002\u5728RHEL\/CentOS7.x\u4ee5\u53ca8.x\u4e2d\u5219\u662f\u4f7f\u7528\u7684systemd\u7684target\u6765\u53d6\u4ee3\u6b64\u524d\u7684\u4e09\u8005\uff0c\u5b9e\u73b0\u7c7b\u4f3c\u8fd0\u884c\u7ea7\u522b\u6765\u6292\u53d1\u7279\u5b9a\u7684\u64cd\u4f5c\u6a21\u5f0f\u7684\u76ee\u7684\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemd\u7684target\u8868\u73b0\u4e3atarget\u5355\u5143\uff0c\u5373\u4ee5.target\u4e3a\u7ed3\u5c3e\u7684\u6587\u4ef6\uff0c\u5176\u60df\u4e00\u7684\u76ee\u7684\u5c31\u662f\u5c06\u5176\u4ed6systemd\u7684\u5355\u5143\uff08unit\uff09\u6839\u636e\u4f9d\u8d56\u5173\u7cfb\u94fe\u8fdb\u884c\u5206\u7ec4\u3002\u4f8b\u5982graphical.target\u8fd9\u4e2a\u5355\u5143\u7528\u4e8e\u542f\u52a8\u4e00\u4e2a\u56fe\u5f62\u5316\u7684\u4ea4\u4e92\u73af\u5883\uff0c\u5176\u4f1a\u542f\u52a8\u4f8b\u5982GNOMEDisplayManager\uff08gdm.service\uff09\u8fd9\u4e2a\u7cfb\u7edf\u670d\u52a1\u3001AccountService\uff08accounts-daemon.service\uff09\u8fd9\u4e2a\u670d\u52a1\uff0c\u540c\u65f6\u4e5f\u4f1a\u6fc0\u6d3bmulti-user.target\u8fd9\u4e2a\u5355\u5143\u3002\u7c7b\u4f3c\u7684\uff0cmulti-user.target\u8fd9\u4e2a\u5355\u5143\u4f1a\u542f\u52a8\u4e00\u4e9b\u5176\u4ed6\u5fc5\u8981\u7684\u7cfb\u7edf\u670d\u52a1\uff0c\u4f8b\u5982NetworkManager\uff08NetworkManager.service\uff09\u6216\u5219D-Bus\uff08dbus.service\uff09\uff0c\u540c\u65f6\u6fc0\u6d3bbasic.target\u8fd9\u4e2a\u5355\u5143\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8e\u5404\u7c7b\u8fd0\u884c\u7ea7\u522b\uff0c\u53c2\u89c1\u672c\u7bc7\u535a\u5ba2\u7684\u7b2c\u4e00\u90e8\u4efd\u7684\u5185\u5bb9\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u67e5\u770b\u548c\u5207\u6362\u8fd0\u884c\u7ea7\u522b\uff0c\u65b0\u8001\u547d\u4ee4\u7684\u5bf9\u4f8b\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>OldCommandNewCommandDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctllist-units--typetarget<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Listscurrentlyloadedtargetunits.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>telinit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>runlevel<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlisolatename.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Changesthecurrenttarget.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u7684\u9ed8\u8ba4target\uff0c\u6267\u884c\u547d\u4ee4systemctlget-default\u5373\u53ef\u3002\u8981\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e0a\u65e9\u5df2\u88c5\u8f7d\u7684\u6240\u6709\u7684target\u5355\u5143\uff0c\u6267\u884c\u547d\u4ee4systemctllist-units--typetarget\u5373\u53ef\u3002\u5bf9\u4e8e\u6bcf\u4e00\u4e2atarget\u5355\u5143\uff0c\u8fd9\u4e2a\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5b8c\u6574\u7684\u540d\u5b50\uff08UNIT\uff09\u3001\u8be5\u5355\u5143\u662f\u5426\u88ab\u88c5\u8f7d\uff08LOAD\uff09\u3001\u9ad8\u7ea7\uff08ACTIVE\uff09\u5355\u5143\u548c\u4f4e\u7ea7\uff08SUB\uff09\u5355\u5143\u7684\u6fc0\u6d3b\u72b6\u6001\u4ee5\u53ca\u8be5\u5355\u5143\u7684\u7b80\u7565\u63cf\u8ff0\uff08DESCRIPTION\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0csystemctllist-units--targettarget\u53ea\u4f1a\u5217\u4e3e\u6d3b\u52a8\u7684\u5355\u5143\uff0c\u5047\u5982\u60f3\u8981\u5217\u4e3e\u6240\u6709\u7684target\u5355\u5143\uff0c\u800c\u4e0d\u7ba1\u5176\u662f\u5426\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u8fd9\u4e48\u6b64\u65f6\u5c31\u987b\u8981\u5728\u547d\u4ee4\u884c\u4e2d\u52a0\u4e0a\u9009\u9879--all\/-a\u3002\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctllist-units--typetarget--all\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u7ed9\u5f53\u524d\u7cfb\u7edf\u8bbe\u7f6e\u9ed8\u8ba4\u7684target\uff0c\u5373\u8bbe\u7f6e\u9ed8\u8ba4\u8fd0\u884c\u7ea7\u522b\uff0c\u6b64\u65f6\u5c31\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlset-defaultname.target\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06\u94fe\u63a5\u6587\u4ef6\/etc\/systemd\/system\/default.target\u6307\u5411\/usr\/lib\/systemd\/system\/name.target\uff0c\u8fd9\u4e48\u4e0a\u6b21\u7cfb\u7edf\u542f\u52a8\u7684\u65f6\u4faf\uff0c\u9ed8\u8ba4\u7684\u8fd0\u884c\u7ea7\u522b\u5c31\u5f04\u6210\u4e86name.target\u6240\u6307\u5b9a\u7684\u8fd0\u884c\u7ea7\u522b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u4e34\u65f6\u66f4\u6539target\uff0c\u8fd9\u4e48\u5c31\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlisolatename.target\u5373\u53ef\u3002\u4f8b\u5982\u5c06\u5f53\u524d\u7684target\u66f4\u6539\u4e3a\u89e3\u6551\u6a21\u5f0f\uff0c\u53carescue.target\uff0c\u6267\u884c\u547d\u4ee4systemctlisolaterescue.target\u5373\u53ef\uff0c\u66f4\u7b80\u5355\u7684\u5199\u6cd5\u662fsystemctlrescue\uff0c\u8fd9\u4e24\u79cd\u65b9\u6cd5\u7684\u7597\u6548\u76f8\u540c\u3002\u5728\u5207\u6362\u5230\u89e3\u6551\u6a21\u5f0f\u4ee5\u540e\uff0c\u7cfb\u7edf\u4f1a\u5c1d\u8bd5\u6302\u5728\u6240\u6709\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\uff0c\u800c\u4e14\u4f1a\u542f\u52a8\u4e00\u4e9b\u91cd\u8981\u7684\u7cfb\u7edf\u670d\u52a1\uff0c\u800c\u4e14\u5e76\u4e0d\u4f1a\u6fc0\u6d3b\u7f51\u5361\u63d2\u53e3\uff0c\u4e5f\u4e0d\u5141\u8bb8\u591a\u7528\u6237\u767b\u9646\uff0c\u6b64\u65f6\u53ea\u5bb9\u8bb8root\u7528\u6237\u767b\u5165\u3002\u5728\u5207\u6362\u4e3a\u89e3\u6551\u6a21\u5f0f\u4ee5\u540e\uff0c\u987b\u8981\u6b63\u786e\u8f93\u5165root\u7528\u6237\u7684\u5bc6\u7801\u4ee5\u540e\u624d\u4f1a\u6b65\u5165\u5230\u89e3\u6551\u6a21\u5f0f\u3002\u53e6\u5916\uff0c\u5728\u5207\u6362\u5230\u89e3\u6551\u6a21\u5f0f\u7684\u65f6\u4faf\uff0c\u7cfb\u7edf\u9ed8\u8ba4\u4f1a\u7ed9\u6240\u6709\u5f53\u524d\u6b63\u5904\u4e8e\u767b\u5165\u72b6\u6001\u7684\u7528\u6237\u53d1\u9001\u5e7f\u64ad\u6d88\u606f\uff0c\u5047\u5982\u8981\u7981\u7528\u8fd9\u4e2a\u5e7f\u64ad\u6d88\u606f\uff0c\u6b64\u65f6\u53ef\u4ee5\u52a0\u4e0a\u9009\u9879--no-wall\u5373\u53ef\uff0c\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctl--no-wallrescue\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u5207\u6362\u4e3a\u7d27\u6025\u6a21\u5f0f\uff0c\u5373emergency.target\u5355\u5143\uff0c\u6b64\u65f6\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlisolateemergency.target\uff0c\u6216\u5219\u66f4\u7b80\u7565\u7684\u65b9\u5f0fsystemctlemergency\uff0c\u8fd9\u4e24\u79cd\u547d\u4ee4\u65b9\u5f0f\u7597\u6548\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f\u5207\u6362\u5230\u7d27\u6025\u6a21\u5f0f\u3002\u5728\u7d27\u6025\u6a21\u5f0f\u4e2d\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u5c06\u6839\u5206\u533a\u6302\u8f7d\u4e3a\u53ea\u8bfb\u65b9\u5f0f\uff0c\u800c\u4e14\u4e0d\u4f1a\u5c1d\u8bd5\u6302\u8f7d\u5176\u4ed6\u6587\u4ef6\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\uff0c\u540c\u6837\u4e0d\u4f1a\u6fc0\u6d3b\u7f51\u5361\u63d2\u53e3\uff0c\u800c\u4e14\u53ea\u4f1a\u542f\u52a8\u4e00\u4e9b\u5fc5\u8981\u7684\u670d\u52a1\uff0c\u540c\u6837\u4e0d\u5141\u8bb8\u591a\u7528\u6237\u767b\u5165\u3002\u5728\u5207\u6362\u4e3a\u7d27\u6025\u6a21\u5f0f\u4ee5\u540e\uff0c\u987b\u8981\u6b63\u786e\u8f93\u5165root\u7528\u6237\u5bc6\u7801\u4ee5\u540e\u624d\u4f1a\u6b65\u5165\u5230\u7d27\u6025\u6a21\u5f0f\u3002\u53e6\u5916\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728\u5207\u6362\u4e3a\u7d27\u6025\u6a21\u5f0f\u7684\u65f6\u4faf\u7cfb\u7edf\u4f1a\u7ed9\u5f53\u524d\u6b63\u5904\u4e8e\u767b\u5165\u72b6\u6001\u7684\u7528\u6237\u53d1\u9001\u5e7f\u64ad\u6d88\u606f\u3002\u5047\u5982\u8981\u7981\u7528\u5e7f\u64ad\u6d88\u606f\uff0c\u53ef\u4ee5\u52a0\u4e0a\u9009\u9879--no-wall\uff0c\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctlisolateemergency--no-wall\u6216\u5219systemctl--no-wallemergency\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.5.systemctl\u547d\u4ee4\u5b9e\u73b0\u7cfb\u7edf\u5173\u6389\u3001\u6302\u8d77\u548c\u51ac\u7720<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2024\/04\/1713873802191_2.jpg' alt='linux\u91cd\u7f6e\u78c1\u76d8_linux\u7cfb\u7edf\u91cd\u7f6e_linux\u91cd\u7f6e\u7cfb\u7edf\u76d8\u547d\u4ee4' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>RHEL\/CentOS7.x\u5f00\u59cb\uff0c\u7531systemd\u63d0\u4f9b\u7cfb\u7edf\u7684\u7535\u6e90\u7ba1\u7406\u547d\u4ee4\u3002\u76f8\u5173\u7684\u7535\u6e90\u7ba1\u7406\u547d\u4ee4\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>OldCommandNewCommandDescription<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>halt<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlhalt<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Haltsthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>poweroff<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlpoweroff<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Powersoffthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>reboot<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlreboot<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Restartsthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>pm-suspend<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlsuspend<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Suspendsthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>pm-hibernate<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlhibernate<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Hibernatesthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>pm-suspend-hybrid<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>systemctlhybrid-sleep<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Hibernatesandsuspendsthesystem.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u5173\u6389\u8fd0\u884c\u7684\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4f20\u7edf\u7684shutdown\u547d\u4ee4\uff0c\u4f8b\u5982shutdown-hnow\u5373\u53ef\u7acb\u523b\u5173\u6389\u7cfb\u7edf\u3002\u800c\u4f7f\u7528systemctl\u547d\u4ee4\u8fdb\u884c\u7cfb\u7edf\u5173\u6389\u7684\u64cd\u4f5c\uff0c\u5c31\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlpoweroff\u5373\u53ef\uff0c\u8fd9\u4e2a\u547d\u4ee4\u76f8\u5f53\u4e8e\u76f4\u63a5\u957f\u6309\u4e3b\u673a\u7684\u7535\u6e90\u952e\u8fdb\u884c\u6b7b\u673a\u3002\u5047\u5982\u8981\u901a\u8fc7\u5173\u6389\u5e76\u505c\u6b62\u7cfb\u7edf\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u7c7b\u4f3c\u6309\u7535\u6e90\u952e\u6b7b\u673a\u7684\u7684\u7597\u6548\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlhalt\u5373\u53ef\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u5c31\u4f1a\u7ed9\u767b\u9646\u7528\u6237\u53d1\u9001\u5e7f\u64ad\u6d88\u606f\uff0c\u5047\u82e5\u4e0d\u60f3\u7528\u6237\u6536\u5230\u5e7f\u64ad\u6d88\u606f\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u964d\u4f4e\u9009\u9879--no-wall\u5373\u53ef\u3002\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctl--no-wallpoweroff\u6216\u5219systemctl--no-wallhalt\uff0c\u8fd9\u4e8c\u8005\u90fd\u53ef\u4ee5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5018\u82e5\u4e0d\u662f\u7acb\u523b\u5173\u6389\uff0c\u5b9e\u73b0\u5ef6\u65f6\u5173\u6389\u7684\u7597\u6548\uff0c\u6b64\u65f6\u5c31\u987b\u8981\u5c06\u4e0a\u8ff0\u7684\u547d\u4ee4\u6539\u4e3a\u9009\u9879\u6a21\u5f0f\uff0c\u4f8b\u5982\u6307\u5b9a\u5728\u51e0\u70b9\u51e0\u5206\u5173\u6389\u7cfb\u7edf\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctl--poweroffHH:MM\u5373\u53ef\uff0c\u6ce8\u610f\uff0c\u6b64\u65f6poweroff\u8fd9\u4e2a\u547d\u4ee4\u5df2\u7136\u5f04\u6210\u957f\u9009\u9879\u683c\u5f0f\u4e86\uff0c\u4e0d\u8981\u7701\u7565\u6389\u4e24\u4e2a\u4e2d\u6587\u5168\u89d2\u8fde\u5b57\u7b26\u3002\u5047\u5982\u8981\u6307\u5b9a\u5728\u51e0\u5206\u949f\u6216\u5219\u51e0\u4e2a\u5c0f\u65f6\u4ee5\u540e\u5173\u6389\u7cfb\u7edf\uff0c\u6b64\u65f6\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctl--halt+m\uff0c\u8fd9\u6761\u547d\u4ee4\u4e2d\u7684halt\u540c\u6837\u53d8\u4e3a\u9009\u9879\u6a21\u5f0f\uff0c\u4e0d\u80fd\u7701\u7565\u4e24\u4e2a\u4e2d\u6587\u5168\u89d2\u8fde\u5b57\u7b26\uff0c\u540c\u65f6+m\u8868\u793am\u5206\u949f\u540e\u5173\u6389\u7cfb\u7edf\u3002\u82e5\u679c\u5c06+m\u66ff\u6362\u4e3anow\uff0c\u5219\u7b49\u6548\u4e8e+0\uff0c\u8868\u793a\u7acb\u523b\u5173\u6389\u7cfb\u7edf\u3002\u5bf9\u4e8e\u4e0a\u8ff0\u4ecd\u672a\u6267\u884c\u7684\u6302\u8d77\u72b6\u6001\u7684\u6b7b\u673a\u547d\u4ee4\uff0c\u53ef\u4ee5\u6267\u884cshutdown-c\u8fdb\u884c\u53d6\u6d88\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u91cd\u542f\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlreboot\u5373\u53ef\uff0c\u9ed8\u8ba4\u8be5\u547d\u4ee4\u4f1a\u7ed9\u6240\u6709\u65e9\u5df2\u767b\u5165\u7684\u7528\u6237\u53d1\u9001\u5e7f\u64ad\u6d88\u606f\uff0c\u5047\u5982\u8981\u7981\u7528\u8fd9\u4e2a\u5e7f\u64ad\u6d88\u606f\uff0c\u6b64\u65f6\u53ef\u4ee5\u52a0\u4e0a\u547d\u4ee4\u884c\u9009\u9879--no-wall\u5373\u53ef\uff0c\u6b64\u65f6\u7684\u547d\u4ee4\u4e3asystemctl--no-wallreboot\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u6302\u8d77\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlsuspend\u5373\u53ef\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06\u7cfb\u7edf\u7684\u72b6\u6001\u4fe1\u606f\u4fdd\u5b58\u5230\u663e\u5b58\u4e2d\uff0c\u5f53\u65c1\u8fb9\u5207\u6362\u56de\u7cfb\u7edf\u7684\u65f6\u4faf\uff0c\u7cfb\u7edf\u4f1a\u76f4\u63a5\u4ece\u663e\u5b58\u4e2d\u56de\u590d\u6b64\u524d\u4fdd\u5b58\u7684\u72b6\u6001\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf\u3002\u56e0\u4e3a\u7cfb\u7edf\u7684\u72b6\u6001\u4fe1\u606f\u662f\u4fdd\u5b58\u5728\u7cfb\u7edf\u7684\u663e\u5b58\u4e2d\uff0c\u800c\u4e0d\u662f\u4fdd\u5b58\u5728c\u76d8\u4e2d\uff0c\u6240\u4ee5\u6062\u590d\u901f\u7387\u5f88\u5feb\uff0c\u4f46\u4e0e\u6b64\u540c\u65f6\uff0c\u4e5f\u4f1a\u9020\u6210\u5f53\u7cfb\u7edf\u906d\u5230\u5ffd\u7136\u7684\u65ad\u7535\u65f6\u5bfc\u81f4\u4fdd\u5b58\u7684\u72b6\u6001\u9057\u5931\u7684\u60c5\u51b5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5018\u82e5\u8981\u5c06\u7cfb\u7edf\u51ac\u7720\uff0c\u6b64\u65f6\u5c31\u987b\u8981\u6267\u884c\u547d\u4ee4systemctlhibernate\u3002\u8fd9\u4e2a\u547d\u4ee4\u5c06\u7cfb\u7edf\u72b6\u6001\u4fdd\u5b58\u5230c\u76d8\u4e2d\uff0c\u4e4b\u540e\u5173\u6389\u7cfb\u7edf\u3002\u5f53\u4f60\u91cd\u65b0\u5207\u56de\u5230\u7cfb\u7edf\u7684\u65f6\u4faf\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u4ece\u786c\u789f\u4e2d\u8bfb\u53d6\u4fdd\u5b58\u7684\u72b6\u6001\u5b8c\u6210\u6062\u590d\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf\u3002\u56e0\u4e3a\u7cfb\u7edf\u72b6\u6001\u4fe1\u606f\u662f\u4fdd\u5b58\u5728\u786c\u789f\u4e2d\uff0c\u800c\u4e0d\u662f\u4fdd\u5b58\u5728\u663e\u5b58\u4e2d\uff0c\u6240\u4ee5\u6062\u590d\u7684\u65f6\u4faf\u901f\u7387\u4f1a\u76f8\u5bf9\u8f83\u6162\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u8981\u51ac\u7720\u800c\u4e14\u6302\u8d77\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6267\u884c\u547d\u4ee4systemctlhybrid-sleep\u547d\u4ee4\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.6.\u63a7\u5236\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684systemd<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0d\u4ec5\u53ef\u4ee5\u63a7\u5236\u672c\u5730\u7cfb\u7edf\u7684systemd\u4ee5\u53ca\u670d\u52a1\u7ba1\u7406\u4e4b\u5916\uff0csystemctl\u547d\u4ee4\u8fd8\u53ef\u4ee5\u901a\u8fc7ssh\u5408\u540c\u4e0e\u8fdc\u7a0b\u4e3b\u673a\u7684systemd\u8fdb\u884c\u4ea4\u4e92\u3002\u987b\u8981\u786e\u4fdd\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684sshd\u670d\u52a1\u5904\u4e8e\u5f00\u542f\u72b6\u6001\uff0c\u6b64\u65f6\u5c31\u53ef\u4ee5\u901a\u8fc7systemctl-H\/--host\u65b9\u5f0f\u7684\u547d\u4ee4\u5bf9\u8fdc\u7a0b\u4e3b\u673a\u8fdb\u884c\u64cd\u4f5c\u4e86\u3002\u5177\u4f53\u547d\u4ee4\u4e3asystemctl--hostremote_user@remote_hostcommand\u5373\u53ef\u3002\u5177\u4f53\u5982\u4e0b\u8fb9\u7684\u793a\u4f8b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -H root@c7u6-ha1 is-active sshd.service<\/span>\nactive\n<span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl -H root@c7u6-ha1 status sshd.service<\/span>\n\u25cf sshd.service - OpenSSH server daemon\n   Loaded: loaded <span class=\"token punctuation\">(<\/span>\/usr\/lib\/systemd\/system\/sshd.service<span class=\"token punctuation\">;<\/span> enabled<span class=\"token punctuation\">;<\/span> vendor preset: enabled<span class=\"token punctuation\">)<\/span>\n   Active: active <span class=\"token punctuation\">(<\/span>running<span class=\"token punctuation\">)<\/span> since Mon <span class=\"token number\">2021<\/span>-06-07 <span class=\"token number\">11<\/span>:12:56 CST<span class=\"token punctuation\">;<\/span> 13h ago\n     Docs: man:sshd<span class=\"token punctuation\">(<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span>\n           man:sshd_config<span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>\n Main PID: <span class=\"token number\">2985<\/span>\n   CGroup: \/system.slice\/sshd.service\n           \u2514\u25001715308 \/usr\/sbin\/sshd -D -oCiphers<span class=\"token operator\">=<\/span>aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.c<span class=\"token operator\">&gt;<\/span>\n           \u2023 <span class=\"token number\">2985<\/span> \/usr\/libexec\/gsd-power\nlines <span class=\"token number\">1<\/span>-9\/9 <span class=\"token punctuation\">(<\/span>END<span class=\"token punctuation\">)<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u5728\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u5206\u522b\u6267\u884c\u4e86\u4e24\u6761\u547d\u4ee4\uff0c\u7b2c\u4e00\u6761\u547d\u4ee4\u67e5\u770b\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684sshd.service\u670d\u52a1\u662f\u5426\u5904\u4e8e\u6fc0\u6d3b\u72b6\u6001\uff1b\u7b2c\u4e8c\u6761\u547d\u4ee4\u662f\u67e5\u770b\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684sshd.service\u670d\u52a1\u7684\u72b6\u6001\u4fe1\u606f\u3002\u4e3a\u4e86\u4e0e\u4e0a\u8ff0\u7684\u8f93\u51fa\u7ed3\u679c\u505a\u5bf9\u6bd4\uff0c\u4e0b\u8fb9\u5728\u672c\u673a\u4e0a\u518d\u67e5\u770b\u4e00\u4e0bsshd.service\u7684\u72b6\u6001\u4fe1\u606f\uff0c\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl status sshd.service<\/span>\n<span class=\"token builtin class-name\">.<\/span> sshd.service - OpenSSH server daemon\n   Loaded: loaded <span class=\"token punctuation\">(<\/span>\/usr\/lib\/systemd\/system\/sshd.service<span class=\"token punctuation\">;<\/span> enabled<span class=\"token punctuation\">;<\/span> vendor preset: enabled<span class=\"token punctuation\">)<\/span>\n   Active: active <span class=\"token punctuation\">(<\/span>running<span class=\"token punctuation\">)<\/span> since Mon <span class=\"token number\">2021<\/span>-06-07 <span class=\"token number\">11<\/span>:14:26 CST<span class=\"token punctuation\">;<\/span> 13h ago\n     Docs: man:sshd<span class=\"token punctuation\">(<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span>\n           man:sshd_config<span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>\n Main PID: <span class=\"token number\">1715308<\/span> <span class=\"token punctuation\">(<\/span>sshd<span class=\"token punctuation\">)<\/span>\n    Tasks: <span class=\"token number\">1<\/span> <span class=\"token punctuation\">(<\/span>limit: <span class=\"token number\">409082<\/span><span class=\"token punctuation\">)<\/span>\n   Memory: <span class=\"token number\">1<\/span>.2M\n   CGroup: \/system.slice\/sshd.service\n           \u2514\u25001715308 \/usr\/sbin\/sshd -D -oCiphers<span class=\"token operator\">=<\/span>aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.c<span class=\"token operator\">&gt;<\/span>\nJun 07 <span class=\"token number\">11<\/span>:14:26 LiuXianQiE systemd<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span>: Starting OpenSSH server daemon<span class=\"token punctuation\">..<\/span>.\nJun 07 <span class=\"token number\">11<\/span>:14:26 LiuXianQiE sshd<span class=\"token punctuation\">[<\/span><span class=\"token number\">1715308<\/span><span class=\"token punctuation\">]<\/span>: Server listening on <span class=\"token number\">0.0<\/span>.0.0 port <span class=\"token number\">22<\/span>.\nJun 07 <span class=\"token number\">11<\/span>:14:26 LiuXianQiE sshd<span class=\"token punctuation\">[<\/span><span class=\"token number\">1715308<\/span><span class=\"token punctuation\">]<\/span>: Server listening on :: port <span class=\"token number\">22<\/span>.\nJun 07 <span class=\"token number\">11<\/span>:14:26 LiuXianQiE systemd<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span>: Started OpenSSH server daemon.\nlines <span class=\"token number\">1<\/span>-15\/15 <span class=\"token punctuation\">(<\/span>END<span class=\"token punctuation\">)<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.7.\u521b\u5efa\u4ee5\u53ca\u66f4\u6539systemd\u7684unit\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u56e0\u4e3asystemd\u7684\u884c\u4e3a\u662f\u7531\u5bf9\u5e94\u7684\u5355\u5143\uff08unit\uff09\u6587\u4ef6\u5b9a\u4e49\u7684\uff0c\u800c\u5355\u5143\u6587\u4ef6\u4e2d\u5305\u542b\u4e86\u5355\u5143\u63cf\u8ff0\u4ee5\u53ca\u884c\u4e3a\u5b9a\u4e49\u7684\u6307\u4ee4\uff0c\u4e3a\u4e86\u66f4\u51fa\u4f17\u7684\u9002\u5e94systemd\u7684\u7ba1\u7406\u65b9\u6cd5\uff0c\u7ba1\u7406\u5458\u901a\u5e38\u987b\u8981\u81ea\u52a8\u7f16\u8f91\u4ee5\u53ca\u521b\u5efa\u5355\u5143\u6587\u4ef6\u3002\u5176\u4e2d\/etc\/systemd\/system\u8fd9\u4e2a\u76ee\u5f55\u7528\u4e8e\u4fdd\u5b58\u7cfb\u7edf\u7ba1\u7406\u5458\u521b\u5efa\u4ee5\u53ca\u81ea\u5b9a\u4e49\u7684\u5355\u5143\u6587\u4ef6\uff0c\u5e76\u4e14\u5b9e\u9645\u4e0a\uff0c\u66f4\u591a\u7684\u662f\u76f4\u63a5\u5728\/usr\/lib\/systemd\/system\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u8fdb\u884c\u5355\u5143\u6587\u4ef6\u7684\u521b\u5efa\u4ee5\u53ca\u7f16\u8f91\u81ea\u5b9a\u4e49\u64cd\u4f5c\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5bf9\u4e8e\u5355\u5143\u6587\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7\u76ee\u5f55\u589e\u8865\u989d\u5916\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f8b\u5982\u8981\u7ed9sshd.service\u589e\u8865\u81ea\u5b9a\u4e49\u914d\u7f6e\u9009\u9879\uff0c\u5c31\u987b\u8981\u521b\u5efasshd.service.d\/custom.conf\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u5e76\u5728\u5176\u4e2d\u63d2\u5165\u989d\u5916\u7684\u914d\u7f6e\u6307\u4ee4\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u521b\u5efasshd.service.wants\/\u76ee\u5f55\u4ee5\u53casshd.service.requires\/\u76ee\u5f55\uff0c\u8fd9\u4e24\u4e2a\u76ee\u5f55\u4e2d\u5305\u542b\u4e86sshd\u670d\u52a1\u6240\u4f9d\u8d56\u670d\u52a1\u7684\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u3002\u90a3\u4e9b\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u662f\u6839\u636esshd\u670d\u52a1\u7684\u5355\u5143\u6587\u4ef6sshd.service\u4e2d\u7684[Install]\u9009\u9879\u624b\u52a8\u521b\u5efa\u4e0b\u6765\u7684\uff0c\u6216\u5219\u662f\u5728\u8fd0\u884c\u65f6\u57fa\u4e8e[Unit]\u9009\u9879\u624b\u52a8\u521b\u5efa\u4e0b\u6765\u7684\u3002\u5176\u5b9e\uff0c\u4e5f\u53ef\u4ee5\u81ea\u52a8\u521b\u5efa\u8fd9\u79cd\u76ee\u5f55\u548c\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.7.1.\u7406\u89e3\u5355\u5143\u6587\u4ef6\uff08unitfile\uff09\u7684\u7ed3\u6784<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5355\u5143\u6587\u4ef6\u5178\u578b\u7684\u7ed3\u6784\u7531\u4e09\u90e8\u4efd\u7ec4\u6210\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Table1:Important[Unit]SectionOptions<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Option[a]Description<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Description<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Ameaningfuldescriptionoftheunit.Thistextisdisplayedforexampleintheoutputofthesystemctlstatuscommand.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Documentation<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ProvidesalistofURIsreferencingdocumentationfortheunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>After[b]<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Definestheorderinwhichunitsarestarted.TheunitstartsonlyaftertheunitsspecifiedinAfterareactive.UnlikeRequires,Afterdoesn\u2019texplicitlyactivatethespecifiedunits.TheBeforeoptionhastheoppositefunctionalitytoAfter.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Requires<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Configuresthedependenciesonotherunits.TheunitslistedinRequiresareactivatedtogetherwiththeunit.Ifanyoftherequiredunitsfailtostart,theunitisnotactivated.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Wants<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ConfiguresweakerdependenciesthanRequires.Ifanyofthelistedunitsdoesnotstartsuccessfully,ithasnoimpactontheunitactivation.Thisistherecommendedwaytoestablishcustomunitdependencies.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Confilicts<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Configuresnegativedependencies,anoppositetoRequires.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[a]:\u5173\u4e8e[Unit]\u90e8\u4efd\u66f4\u8be6\u7ec6\u7684\u914d\u7f6e\u9009\u9879\uff0c\u53c2\u89c1**systemd.unit(5)**\u5e2e\u52a9\u6307\u5357\uff0c\u5373man5systemd.unit\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[b]:\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u53ea\u987b\u8981\u5728[Unit]\u90e8\u4efd\u901a\u8fc7After\u4ee5\u53caBefore\u5c31\u8db3\u4ee5\u6307\u5b9a\u6b21\u5e8f\u4f9d\u8d56\u5173\u7cfb\u3002\u5047\u5982\u4e0e\u6b64\u540c\u65f6\u4e5f\u8bbe\u7f6e\u4e86Wants\u6216\u5219Requires\u6307\u5b9a\u9700\u6c42\u7684\u5355\u5143\uff0c\u8fd9\u4e48\u4f9d\u7136\u987b\u8981\u901a\u8fc7After\u4ee5\u53caBefore\u6307\u5b9a\u6b21\u5e8f\u4f9d\u8d56\u5173\u7cfb\u3002\u8fd9\u662f\u7531\u4e8e\u6b21\u5e8f\u4ee5\u6765\u5173\u7cfb\u548c\u9700\u6c42\u7684\u5355\u5143\u4e4b\u95f4\u5f7c\u6b64\u662f\u4e92\u76f8\u72ec\u7acb\u7684\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Table2:Important[Service]SectionOptions<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Option[a]Description<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Type<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ConfigurestheunitprocessstartuptypethataffectsthefunctionalityofExecStartandrelatedoptions.Oneof:<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>1.simple:Thedefaultvalue.TheprocessstartedwithExecStartisthemainprocessoftheservice.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.forking:TheprocessstartedwithExecStartspawnsachildprocessthatbecomesthemainprocessoftheservice.Theparentprocessexitswhenthestartupiscomplete.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.oneshot:Thistypeissimilartosimple,buttheprocessexitsbeforestartingconsequentunits.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>4.dbus:Thistypeissimilartosimple,butconsequentunitsarestartedonlyafterthemainprocessgainsaD-Busname.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>5.notify:Thistypeissimilartosimple,butconsequentunitsarestartedonlyafteranotificationmessageissentviathesd_notify()function.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>6.idle:Similartosimple,theacutalexecutionoftheservicebinaryisdelayeduntilalljobsarefinished,whichavoidsmixingthestatusoutputwithshelloutputofservices.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecStart<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Specifiescommandsorscriptstobeexecutedwhentheunitisstarted.ExecStartPreandExecStartPostspecifycustomcommandstobeexecutedbeforeandafterExecStart.Type=oneshotenablesspecifyingmultiplecustomcommandsthatarethenexecutedsequentially.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecStop<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Specifiescommandsorscriptstobeexecutedwhentheunitisstopped.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecReload<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Specifiescommandsorscriptstobeexecutedwhentheunitisreloaded.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Restart<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Withthisoptionenabled,theserviceisrestartedafteritsprocessexits,withtheexceptionofacleanstopbythesystemctlcommand.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>RemainAfterExit<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>IfsettoTrue,theserviceisconsideredactiveevenwhenallitsprocessesexited.DefaultvalueisFalse.ThisoptionisespeciallyusefulifType=oneshotisconfigured.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[a]:\u8981\u67e5\u770b\u5173\u4e8e[Service]\u90e8\u4efd\u7684\u5b8c\u6574\u9009\u9879\u5217\u8868\uff0c\u53c2\u89c1systemd.service(5)\u7684\u5e2e\u52a9\u6307\u5357\uff0c\u5373\u6267\u884c\u547d\u4ee4man5systemd.service\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Table3:Important[Install]Sectionoptions<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Option[a]Description<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Alias<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Providesaspace-separatedlistofadditionalnamesfortheunit.Mostsystemctlcommands,excludingsystemctlenable,canusealiasinsteadoftheactualunitname.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>RequiredBy<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Alistofunitsthatdependontheunit.Whenthisunitisenabled,theunitlistedinRequiredBygainaRequiredependencyontheunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>WantedBy<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Alistofunitsthatweaklydependontheunit.Whenthisunitisenabled,theunitslistedinWantedBygainaWantdependencyontheunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Also<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Specifiesalistofunitstobeinstalledoruninstalledalongwiththeunit.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>DefaultInstance<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Limitedtoinstantiatedunits,thisoptionspecifiesthedefaultinstanceforwhichtheunitisenabled.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[a]:\u5173\u4e8e[Install]\u66f4\u8be6\u5c3d\u7684\u9009\u9879\u5217\u8868\uff0c\u53c2\u89c1systemd.unit(5)\u7684\u5e2e\u52a9\u6307\u5357\uff0c\u5373\u6267\u884c\u547d\u4ee4man5systemd.unit\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8e\u8fd9\u4e09\u90e8\u4efd\u7684\u5185\u5bb9\u7ec4\u7ec7\uff0c\u4ee5sshd.service\u5355\u5143\u6587\u4ef6\u7684\u5185\u5bb9\u4e3a\u4f8b\uff0c\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u56fe\u7684[Unit]\u90e8\u4efd\u6307\u5b9a\u4e86sshd\u670d\u52a1\u7684\u57fa\u672c\u63cf\u8ff0\u4fe1\u606f\uff0c\u4ee5\u53ca\u8fd9\u4e2a\u670d\u52a1\u7684\u5e2e\u52a9\u6587\u6863\u83b7\u53d6\u65b9\u6cd5\uff1b\u540c\u65f6\u6307\u5b9a\u4e86\u8be5\u670d\u52a1\u7684\u4ee5\u6765\u5173\u7cfb\uff0c\u5373sshd\u670d\u52a1\u4f9d\u8d56network.target\u548csshd-keygen.target\u8fd9\u4e24\u4e2a\u5355\u5143\uff0c\u987b\u8981\u5728\u8fd9\u4e24\u4e2a\u5355\u5143\u5c31\u7eea\u4ee5\u540e\u624d\u4f1a\u542f\u52a8sshd\u670d\u52a1\uff1b\u4e5f\u901a\u8fc7Wants\u663e\u5f0f\u7533\u660e\u4e86\u8be5\u670d\u52a1\u987b\u8981ssh-keygen.target\u8fd9\u4e2a\u5355\u5143\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u7684[Service]\u90e8\u4efd\uff0c\u6307\u5b9a\u4e86\u670d\u52a1\u7684\u8fdb\u7a0b\u542f\u52a8\u7c7b\u578b\u53d7ExecStart\u9009\u9879\u7684\u5f71\u54cd\u5f62\u5f0f\uff0cnotify\u7684\u542b\u610f\u662f\u8be5\u670d\u52a1\u7684\u8fdb\u7a0b\u88abExecStart\u542f\u52a8\u4ee5\u540e\u4ee5\u4e3b\u8fdb\u7a0b\u7684\u65b9\u5f0f\u5b58\u5728\uff0c\u6b64\u540e\u7684\u5355\u5143\u53ea\u662f\u5728\u901a\u8fc7sd_notify()\u51fd\u6570\u53d1\u9001\u4e86\u901a\u77e5\u6d88\u606f\u4ee5\u540e\u624d\u80fd\u542f\u52a8\u3002ExecStart\u6307\u5b9a\u4e86\u670d\u52a1\u7684\u542f\u52a8\u547d\u4ee4\uff0cExecReload\u6307\u5b9a\u4e86\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\u65f6\u987b\u8981\u6267\u884c\u7684\u64cd\u4f5c\uff08\u53c2\u89c1man5systemd.service\u7684\u8f93\u51fa\uff09\uff1bKillMode\u6307\u5b9a\u4e86\u8fdb\u7a0b\u5e94\u5f53\u4ee5\u5982\u4f55\u7684\u5f62\u5f0f\u88ab\u5173\u6389\uff0cprocess\u8868\u793a\u53ea\u6709\u4e3b\u8fdb\u7a0b\u4f1a\u88ab\u6740\u6389\uff08\u5173\u4e8eKillMode\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u53c2\u89c1man5systemd.kill\u7684\u8f93\u51fa\uff09\u3002Restart\u8868\u793a\u5728\u54ea\u4e9b\u60c5\u51b5\u4e0b\u987b\u8981\u91cd\u542f\u8be5\u670d\u52a1\uff0con-failure\u7684\u6db5\u4e49\u662f\u5f53\u670d\u52a1\u7684\u8fdb\u7a0b\u8fd4\u56de\u975e\u96f6\u9000\u51fa\u72b6\u6001\u7801\u7684\u65f6\u4faf\uff0c\u624d\u80fd\u91cd\u542f\u8be5\u670d\u52a1\u7684\u4e3b\u8fdb\u7a0b\uff08\u4f8b\u5982\u5f53\u670d\u52a1\u7684\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\u64cd\u4f5c\u8d85\u65f6\u6216\u5219\u89e6\u53d1\u4e86\u770b\u95e8\u72d7\u8d85\u65f6\u7684\u65f6\u4faf\uff0c\u8be5\u9009\u9879\u7684\u66f4\u8be6\u5c3d\u7684\u4fe1\u606f\uff0c\u53c2\u89c1mansystemd.service\u7684\u8f93\u51fa\uff09\uff1bRestartSec\u8868\u793a\u91cd\u542f\u670d\u52a1\u4e4b\u524d\u7684\u7761\u7720\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c\u9ed8\u8ba4100\u79d2\u3002\u53e6\u5916\uff0c\u8fd8\u901a\u8fc7\u9009\u9879EnvironmentFile\u5b9a\u4e49\u4e86\u4e24\u4e2a\u73af\u5883\u53d8\u91cf\u6587\u4ef6\uff0c\u8be5\u9009\u9879\u6307\u5b9a\u7684\u503c\u5e94\u5f53\u662f\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u6216\u5219\u952e\u503c\u8868\u8fbe\u5f0f\uff0c\u52a0\u4e0a\u524d\u7f00\u82f1\u8bed\u5168\u89d2\u8fde\u5b57\u7b26&#8221;-&#8220;\u7684\u65f6\u4faf\uff0c\u8868\u793a\u5047\u5982\u6307\u5b9a\u7684\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u5c31\u4e0d\u518d\u5c1d\u8bd5\u8bfb\u53d6\u8be5\u6587\u4ef6\uff0c\u540c\u65f6\u4e0d\u4f1a\u8bb0\u5f55\u9519\u8bef\u6216\u5219\u8b66\u544a\u4fe1\u606f\uff08\u5173\u4e8e\u8be5\u9009\u9879\u7684\u66f4\u8be6\u5c3d\u7684\u4fe1\u606f\uff0c\u53c2\u89c1man5systemd.exec\u7684\u8f93\u51fa\uff09\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u56fe\u4e2d[Install]\u90e8\u4efd\u6307\u5b9a\u4e86\u9009\u9879WantedBy\uff0c\u8868\u793a\u5728\u6267\u884csystemctlenable\u547d\u4ee4\u5c06\u8be5\u670d\u52a1\u8bbe\u7f6e\u4e3a\u5f00\u673a\u624b\u52a8\u8fd0\u884c\u7684\u65f6\u4faf\uff0c\u8be5\u670d\u52a1\u6240\u4f9d\u8d56\u7684\u5176\u4ed6\u5355\u5143\uff0c\u6b64\u5904\u6307\u5b9a\u7684\u503c\u4e3amulti-user.target\uff0c\u8868\u793a\u5728\u5f00\u673a\u624b\u52a8\u8fd0\u884c\u8be5\u670d\u52a1\u4e4b\u524d\uff0c\u7cfb\u7edf\u987b\u8981\u5148\u8fd0\u884cmulti-user.target\u8fd9\u4e2a\u5355\u5143\u4ee5\u540e\uff0c\u5c31\u4f1a\u542f\u52a8\u8be5\u670d\u52a1\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.7.2.\u521b\u5efa\u81ea\u5b9a\u4e49\u7684\u5355\u5143\u6587\u4ef6\uff08unitfiles\uff09<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8981\u521b\u5efa\u81ea\u5b9a\u4e49\u7684\u670d\u52a1\u5355\u5143\u6587\u4ef6\uff0c\u901a\u5e38\u7684\u6b65\u9aa4\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6253\u7b97\u81ea\u5b9a\u4e49\u670d\u52a1\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u53ef\u4ee5\u662f\u81ea\u5df1\u5199\u7684\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u662f\u8f6f\u4ef6\u63d0\u4f9b\u8005\u63d0\u4f9b\u7684\u53ef\u6267\u884c\u7a0b\u5e8f\u3002\u5047\u5982\u6709\u5fc5\u8981\uff0c\u53ef\u4ee5\u6253\u7b97PID\u6587\u4ef6\uff0c\u62ff\u6765\u50a8\u5b58\u81ea\u5b9a\u4e49\u670d\u52a1\u7684\u4e3b\u8fdb\u7a0b\u7684PID\u4fe1\u606f\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u6587\u4ef6\u7ed9\u81ea\u5b9a\u4e49\u670d\u52a1\u63d0\u4f9bshell\u53d8\u91cf\u3002\u8bf7\u786e\u4fdd\u811a\u672c\u6216\u5219\u7a0b\u5e8f\u5177\u6709\u6267\u884c\u6743\u9650\uff0c\u5047\u5982\u6ca1\u6709\u6267\u884c\u6743\u9650\uff0c\u987b\u8981\u6267\u884cchmoda+x\u7ed9\u5176\u964d\u4f4e\u6267\u884c\u6743\u9650\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\/etc\/systemd\/system\/\u76ee\u5f55\u6216\u5219\/usr\/lib\/systemd\/system\/\u76ee\u5f55\u4e2d\u521b\u5efa\u81ea\u5b9a\u4e49\u670d\u52a1\u7684\u5355\u5143\u6587\u4ef6\uff08unitfiles\uff09\uff0c\u540c\u65f6\u987b\u8981\u6ce8\u610f\u6587\u4ef6\u7684\u6743\u9650\u3002\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u521b\u5efa\u81ea\u5b9a\u4e49\u670d\u52a1\u7684\u5355\u5143\u6587\u4ef6\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token comment\"># touch \/etc\/systemd\/system\/name.service<\/span>\n<span class=\"token comment\"># chmod 644 \/etc\/systemd\/system\/name.service<\/span>\n\u6216\u8005\n<span class=\"token comment\"># touch \/usr\/lib\/systemd\/system\/name.service<\/span>\n<span class=\"token comment\"># chmod 644 \/usr\/lib\/systemd\/system\/name.service<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u7684\u4e24\u79cd\u65b9\u5f0f\u90fd\u662f\u53ef\u4ee5\u7684\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u4e0a\u9762\u521b\u5efa\u7684\u5355\u5143\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u5bf9\u5e94\u7684\u670d\u52a1\u914d\u7f6e\u9009\u9879\u3002\u4e0b\u8fb9\u7684\u7b80\u5355\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[Unit]<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Description=service_description<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>After=network.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[Service]<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecStart=path_to_executable<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Type=forking<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>PIDFile=path_to_pidfile<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>[Install]<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>WantedBy=default.target<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u8ff0\u7684\u5185\u5bb9\u4e2d\uff0cservice_description\u90e8\u4efd\u4f1a\u663e\u793a\u5728systemctlstatus\u547d\u4ee4\u8f93\u51fa\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002After\u786e\u4fdd\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u670d\u52a1\u5728network.target\u542f\u52a8\u4ee5\u540e\u624d\u80fd\u8fd0\u884c\uff0c\u5047\u5982\u4f9d\u8d56\u591a\u4e2a\u5176\u4ed6\u5355\u5143\uff0c\u8fd9\u4e48\u53ef\u4ee5\u5728After\u9009\u9879\u7684\u65c1\u8fb9\u901a\u8fc7\u7a7a\u683c\u5c06\u591a\u4e2a\u5355\u5143\u5206\u9694\u3002path_to_executable\u4ee3\u8868\u4e86\u624d\u80fd\u542f\u52a8\u670d\u52a1\u7684\u811a\u672c\u6216\u5219\u7a0b\u5e8f\u3002Type=forking\u4ee3\u8868ExecStart\u9009\u9879\u4e2d\u542f\u52a8\u7684\u670d\u52a1\u4f1a\u8c03\u7528fork()\u7a0b\u5e8f\u542f\u52a8\u5b50\u8fdb\u7a0b\uff0c\u5f53\u5b50\u8fdb\u7a0b\u542f\u52a8\u5b8c\u6210\uff0c\u4f46\u662f\u6240\u6709\u7684\u901a\u8baf\u901a\u9053\u90fd\u8bbe\u7f6e\u5b8c\u6210\u4ee5\u540e\uff0c\u6b64\u65f6\u5c31\u5e94\u5f53\u9000\u51fa\u7236\u8fdb\u7a0b\u3002\u6b64\u65f6\u5b50\u8fdb\u7a0b\u4f5c\u4e3a\u670d\u52a1\u7684\u4e3b\u8fdb\u7a0b\u6301\u7eed\u8fd0\u884c\uff0c\u5047\u5982\u4f7f\u7528\u4e86forking\u7684\u65b9\u5f0f\uff0c\u8fd9\u4e48\u4e5f\u987b\u8981\u63d0\u4f9bPIDFile\u6765\u4fdd\u5b58\u670d\u52a1\u7684PID\u4fe1\u606f\uff0c\u4fbf\u4e8esystemd\u5c31\u80fd\u8fa8\u8bc6\u5230\u8fd9\u4e2a\u670d\u52a1\u7684\u8fdb\u7a0b\u3002WantedBy\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u670d\u52a1\u6240\u4f9d\u8d56\u7684\u5176\u4ed6\u5355\u5143\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u901a\u77e5systemd\u5b88\u62a4\u8fdb\u7a0b\uff0c\u6709\u65b0\u7684\u81ea\u5b9a\u4e49\u670d\u52a1\u88ab\u6dfb\u52a0\u8fdb\u6765\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4ee5root\u8eab\u5206\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token comment\"># systemctl daemon-reload<\/span>\n<span class=\"token comment\"># systemctl start name.service<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8b66\u544a\uff1a\u5728\u6bcf\u6b21\u964d\u4f4e\u4e86\u65b0\u7684\u5355\u5143\u6587\u4ef6\u6216\u5219\u66f4\u6539\u4e86\u65e2\u6709\u7684\u5355\u5143\u6587\u4ef6\u4ee5\u540e\uff0c\u90fd\u5e94\u5f53\u6267\u884csystemctldaemon-reload\u547d\u4ee4\u3002\u5426\u5219\u6267\u884csystemctlstart\u6216\u5219systemctlenable\u547d\u4ee4\u7684\u65f6\u4faf\u5c31\u96be\u4ee5\u8fa8\u8bc6\u65b0\u589e\u6216\u66f4\u6539\u7684\u5185\u5bb9\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0b\u8fb9\u901a\u8fc7\u793a\u4f8b\u6f14\u793a\u81ea\u5b9a\u4e49\u670d\u52a1\u7684\u5355\u5143\u6587\u4ef6\u7684\u6b65\u9aa4\u548c\u8fc7\u7a0b\u3002\u4e00\u76f4\u4ee5sshd\u8fd9\u4e2a\u670d\u52a1\u4e3a\u4f8b\uff0c\u521b\u5efasshd\u670d\u52a1\u7684\u7b2c\u4e8c\u4e2a\u5355\u5143\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u4e0d\u540c\u7684\u670d\u52a1\u7aef\u6807\u8bed\u3002\u5177\u4f53\u8fc7\u7a0b\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u590d\u5236\u65e2\u6709\u7684sshd\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp \/etc\/ssh\/sshd{,-second}_config<\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll \/etc\/ssh\/sshd*_config<\/span>\n-rw------- <span class=\"token number\">1<\/span> root root <span class=\"token number\">3908<\/span> Jun  <span class=\"token number\">8<\/span> <span class=\"token number\">14<\/span>:14 \/etc\/ssh\/sshd_config\n-rw------- <span class=\"token number\">1<\/span> root root <span class=\"token number\">3908<\/span> Jun  <span class=\"token number\">8<\/span> <span class=\"token number\">14<\/span>:17 \/etc\/ssh\/sshd-second_config\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u7f16\u8f91\u91cc\u9762\u7684sshd-second_config\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u66f4\u6539\u5176\u4e2d\u7684\u670d\u52a1\u7aef\u6807\u8bed\u548cPID\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># vim \/etc\/ssh\/sshd-second_config<\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/etc\/ssh\/sshd-second_config | egrep &#039;2212|PidFile&#039;<\/span>\nPort <span class=\"token number\">2212<\/span>\nPidFile \/var\/run\/sshd-second.pid\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8esshd_config\u7684\u914d\u7f6e\u9009\u9879\uff0c\u8be6\u5c3d\u4fe1\u606f\u53c2\u89c1sshd_config(5)\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u6267\u884c\u547d\u4ee4man5sshd_config\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u91cc\u9762\u5728\u7b2c\u4e8c\u4e2a\u914d\u7f6e\u6587\u4ef6\u624b\u6307\u5b9a\u7684PID\u6587\u4ef6\u65e0\u9700\u5b9e\u73b0\u521b\u5efa\uff0c\u5728\u91cd\u542fsshd\u670d\u52a1\u7684\u65f6\u4faf\u4f1a\u624b\u52a8\u521b\u5efa\u8fd9\u4e2aPID\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u62f7\u8d1d\u65e2\u6709\u7684sshd.service\u5355\u5143\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp \/usr\/lib\/systemd\/system\/sshd{,-second}.service<\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll \/usr\/lib\/systemd\/system\/sshd*.service<\/span>\n-rw-r--r--. <span class=\"token number\">1<\/span> root root <span class=\"token number\">313<\/span> Apr <span class=\"token number\">11<\/span>  <span class=\"token number\">2018<\/span> \/usr\/lib\/systemd\/system\/sshd-keygen.service\n-rw-r--r--  <span class=\"token number\">1<\/span> root root <span class=\"token number\">373<\/span> Jun  <span class=\"token number\">8<\/span> <span class=\"token number\">14<\/span>:25 \/usr\/lib\/systemd\/system\/sshd-second.service\n-rw-r--r--. <span class=\"token number\">1<\/span> root root <span class=\"token number\">373<\/span> Apr <span class=\"token number\">11<\/span>  <span class=\"token number\">2018<\/span> \/usr\/lib\/systemd\/system\/sshd.service\n-rw-r--r--. <span class=\"token number\">1<\/span> root root <span class=\"token number\">260<\/span> Apr <span class=\"token number\">11<\/span>  <span class=\"token number\">2018<\/span> \/usr\/lib\/systemd\/system\/sshd@.service\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u662f\u5c06sshd.service\u76f4\u63a5\u5728\/usr\/lib\/systemd\/system\/\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u590d\u5236\u4e86\u4e00\u4efd\uff0c\u4e5f\u53ef\u4ee5\u5c06\u5176\u590d\u5236\u5230\/etc\/systemd\/system\/\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u3002RHEL\u5b98\u65b9\u6587\u6863\u5efa\u8bae\u7cfb\u7edf\u7ba1\u7406\u5458\u5e94\u5f53\u5c06\u81ea\u5b9a\u4e49\u7684\u670d\u52a1\u5355\u5143\u6587\u4ef6\u653e\u7f6e\u5728\/etc\/systemd\/system\/\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u66f4\u6539\u6b64\u524d\u590d\u5236\u7684sshd-second.service\u8fd9\u4e2a\u5355\u5143\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>a.\u66f4\u6539Description\u9009\u9879<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Description=OpenSSHserversecondinstancedaemon<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>b.\u5c06sshd.service\u6dfb\u52a0\u4e3a\u8be5\u670d\u52a1\u7684\u4f9d\u8d56\u670d\u52a1\uff0c\u5373sshd-second.service\u987b\u8981\u5728sshd.service\u4ee5\u540e\u542f\u52a8<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>After=syslog.targetnetwork.targetauditd.servicesshd.service<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>c.\u56e0\u4e3a\u7b2c\u4e00\u4e2asshd.service\u4e2d\u65e9\u5df2\u5305\u542b\u4e86\u79d8\u94a5\u751f\u6210\uff0c\u6240\u4ee5\u5728\u7b2c\u4e8c\u4e2a\u670d\u52a1\u4e2d\u987b\u8981\u5c06\u79d8\u94a5\u751f\u6210\u90e8\u4efd\u79fb\u9664<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecStartPre=\/usr\/sbin\/sshd-keygen<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u79fb\u9664\u524d\u9762\u8fd9\u4e00\u884c<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>d.\u6dfb\u52a0-f\/etc\/ssh\/ssh-second_config\u8fd9\u4e2a\u53c2\u6570<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>ExecStart=\/usr\/sbin\/sshd-D-f\/etc\/ssh\/ssh-second_config$OPTIONS<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6267\u884c\u4e86\u4e0a\u8ff0\u66f4\u6539\u4ee5\u540e\uff0c\u6b64\u65f6sshd-second.service\u6587\u4ef6\u7684\u5185\u5bb9\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2024\/04\/1713873802191_3.jpg' alt='linux\u7cfb\u7edf\u91cd\u7f6e_linux\u91cd\u7f6e\u78c1\u76d8_linux\u91cd\u7f6e\u7cfb\u7edf\u76d8\u547d\u4ee4' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/usr\/lib\/systemd\/system\/sshd-second.service<\/span>\n<span class=\"token punctuation\">[<\/span>Unit<span class=\"token punctuation\">]<\/span>\n<span class=\"token assign-left variable\">Description<\/span><span class=\"token operator\">=<\/span>OpenSSH server second instance daemon\n<span class=\"token assign-left variable\">Documentation<\/span><span class=\"token operator\">=<\/span>man:sshd<span class=\"token punctuation\">(<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span> man:sshd_config<span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>\n<span class=\"token assign-left variable\">After<\/span><span class=\"token operator\">=<\/span>network.target sshd-keygen.service sshd.service\n<span class=\"token assign-left variable\">Wants<\/span><span class=\"token operator\">=<\/span>sshd-keygen.service\n<span class=\"token punctuation\">[<\/span>Service<span class=\"token punctuation\">]<\/span>\n<span class=\"token assign-left variable\">Type<\/span><span class=\"token operator\">=<\/span>notify\n<span class=\"token assign-left variable\">EnvironmentFile<\/span><span class=\"token operator\">=<\/span>\/etc\/sysconfig\/sshd\n<span class=\"token assign-left variable\">ExecStart<\/span><span class=\"token operator\">=<\/span>\/usr\/sbin\/sshd -D -f \/etc\/ssh\/sshd-second_config <span class=\"token variable\">$OPTIONS<\/span>\n<span class=\"token assign-left variable\">ExecReload<\/span><span class=\"token operator\">=<\/span>\/bin\/kill -HUP <span class=\"token variable\">$MAINPID<\/span>\n<span class=\"token assign-left variable\">KillMode<\/span><span class=\"token operator\">=<\/span>process\n<span class=\"token assign-left variable\">Restart<\/span><span class=\"token operator\">=<\/span>on-failure\n<span class=\"token assign-left variable\">RestartSec<\/span><span class=\"token operator\">=<\/span>42s\n<span class=\"token punctuation\">[<\/span>Install<span class=\"token punctuation\">]<\/span>\n<span class=\"token assign-left variable\">WantedBy<\/span><span class=\"token operator\">=<\/span>multi-user.target\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u81f3\u6b64\uff0csshd-second.service\u8fd9\u4e2a\u5355\u5143\u6587\u4ef6\u5c31\u6253\u7b97\u597d\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f7f\u80fdsshd-second.service\uff0c\u4f7f\u5176\u80fd\u5426\u5728\u4e0a\u6b21\u5f00\u673a\u7684\u65f6\u4faf\u624b\u52a8\u542f\u52a8<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\uff0c\u5e76\u8bbe\u7f6e\u5f00\u673a\u624b\u52a8\u542f\u52a8\uff0c\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl daemon-reload<\/span>\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl enable --now sshd-second.service<\/span>\nCreated symlink from \/etc\/systemd\/system\/multi-user.target.wants\/sshd-second.service to \/usr\/lib\/systemd\/system\/sshd-second.service.\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u4f7f\u7528systemctldaemon-reload\u901a\u77e5\u670d\u52a1\u8fdb\u7a0b\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u6267\u884cinitq\u547d\u4ee4\uff0c\u5177\u6709\u540c\u6837\u7684\u7597\u6548\u3002\u505a\u5b8c\u4e0a\u8ff0\u8bbe\u7f6e\u4ee5\u540e\uff0c\u67e5\u770b\u7cfb\u7edf\u662f\u5426\u67092212\u7aef\u53e3\u5904\u4e8e\u7a83\u542c\u72b6\u6001\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ss -ntl | egrep 2212<\/span>\nLISTEN     <span class=\"token number\">0<\/span>      <span class=\"token number\">128<\/span>          *:2212                     *:*\nLISTEN     <span class=\"token number\">0<\/span>      <span class=\"token number\">128<\/span>         :::2212                    :::*\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u5bbf\u4e3b\u673a\u4e0a\u5f00\u542f\u53e6\u4e00\u4e2a\u7ec8\u7aef\uff0c\u5e76\u5c1d\u8bd5\u4f7f\u7528\u524d\u9762\u76842212\u53f7\u7aef\u53e3\u767b\u9646\u865a\u62df\u673a\uff0c\u5177\u4f53\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre><code class=\"prism language-bash\"><span class=\"token punctuation\">[<\/span>root@LiuXianQiE ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ssh -p 2212 root@c7u6-ha1<\/span>\nLast login: Tue Jun  <span class=\"token number\">8<\/span> <span class=\"token number\">14<\/span>:19:19 <span class=\"token number\">2021<\/span> from <span class=\"token number\">192.168<\/span>.122.1\n<span class=\"token punctuation\">[<\/span>root@c7u6-ha1 ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#<\/span>\n<\/code><\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4ece\u4e0a\u8ff0\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u53ef\u4ee5\u901a\u8fc72212\u53f7\u7aef\u53e3\u6b63\u5e38\u767b\u9646\u865a\u62df\u673a\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u5373\u4e3a\u521b\u5efa\u81ea\u5b9a\u4e49\u5355\u5143\u6587\u4ef6\u7684\u8fc7\u7a0b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.7.3.\u66f4\u6539\u65e2\u5b58\u5355\u5143\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u65e9\u5df2\u5b89\u88c5\u5230\u7cfb\u7edf\u4e0a\u7684\u670d\u52a1\uff0c\u4f1a\u5c06\u81ea\u5e26\u7684\u9ed8\u8ba4\u5355\u5143\u6587\u4ef6\u50a8\u5b58\u5728\/usr\/llib\/systemd\/system\/\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u3002\u901a\u5e38\u4e0d\u5efa\u8bae\u7cfb\u7edf\u7ba1\u7406\u5458\u76f4\u63a5\u66f4\u6539\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u7684\u5355\u5143\u6587\u4ef6\uff0c\u5e94\u5f53\u5c3d\u91cf\u5c06\u81ea\u5b9a\u4e49\u66f4\u6539\u653e\u7f6e\u5728\/etc\/systemd\/system\/\u8fd9\u4e2a\u76ee\u5f55\u4e2d\u3002\u5177\u4f53\u64cd\u4f5c\u5f62\u5f0f\uff0c\u53d6\u51b3\u4e8e\u6240\u8981\u6c42\u4fee\u6539\u7684\u7a0b\u5ea6\uff0c\u4e0d\u540c\u7684\u66f4\u6539\u7a0b\u5ea6\uff0c\u5bf9\u5e94\u4e8e\u4e0b\u8fb9\u7684\u4e24\u79cd\u5f62\u5f0f\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5173\u4e8eroot\u7528\u6237\u5bc6\u7801\u91cd\u7f6e\uff0c\u6709\u4e24\u79cd\u5f62\u5f0f\uff1a\u7b2c\u4e00\u79cd\u662f\u901a\u8fc7live\u5149\u789f\u8fdb\u884c\u66f4\u6539\uff1b\u7b2c\u4e8c\u79cd\u662f\u901a\u8fc7\u66f4\u6539grub\u4fe1\u606f\u5b9e\u73b0\u66f4\u6539\uff0c\u800c\u8fd9\u4e9b\u65b9\u6cd5\u53c8\u5bf9\u5e94\u4e24\u79cd\u4e0d\u540c\u7684\u5185\u6838\u53c2\u6570\uff0c\u5206\u522b\u4e3ard.break\u548cinit\u6307\u5b9a\u4ea4\u4e92\u7684shell\u7c7b\u5e93\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e24\u79cd\u65b9\u6cd5\u5206\u522b\u4ecb\u7ecd\u5982\u4e0b\uff0c\u4ee5Fedora34\u4e3a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.1.\u901a\u8fc7live\u5149\u789f\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801\u542f\u52a8\u865a\u62df\u673a\uff0c\u5e76\u5728\u5f00\u59cb\u7684\u65f6\u4faf\u9009\u62e9\u4f9d\u7167\u63d0\u793a\u6b65\u5165boot\u83dc\u5355\uff0c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u4e2d\u6309\u4e0bESC\u952e\u6b65\u5165boot\u83dc\u5355\uff0c\u5f39\u51faboot\u83dc\u5355\uff0c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u9009\u62e9\u4e0a\u56fe\u7684\u7b2c2\u9879\u4ece\u786c\u76d8\u542f\u52a8\u7cfb\u7edf\u3002\u5728\u53f3\u56fe\u7684\u5f15\u5bfc\u754c\u9762\u4e2d\u9009\u62e9\u7b2c\u4e00\u4e2a\uff0c\u5373&#8221;StartFedora-Workstation-Live34&#8243;<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6b65\u5165\u5230\u53f3\u56fe\u6240\u793a\u7684\u754c\u9762\uff0c\u9009\u62e9&#8221;TryFedora&#8221;\uff0c\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6253\u5f00terminal\uff0c\u4e4b\u540e\u6267\u884c\u5982\u53f3\u56fe\u6240\u793a\u64cd\u4f5c\uff0c\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.\u91cd\u542f\u7cfb\u7edf\uff0c\u5373\u53ef\u8f93\u5165\u91cd\u7f6e\u540e\u7684\u5bc6\u7801\u8fdb\u884c\u767b\u9646<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u518d\u4e0a\u56fe\u4e2d\u9009\u62e9\u7b2c\u4e00\u4e2a\uff0c\u6b63\u5e38\u542f\u52a8\u7cfb\u7edf\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u4e2d\u8f93\u5165\u7528\u6237\u540droot<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u4e2d\u8f93\u5165\u91cd\u7f6e\u540e\u7684\u5bc6\u7801\uff0c\u5373\u53ef\u767b\u5165\u7cfb\u7edf\uff0c\u5728\u53f3\u56fe\u4e2d\u6253\u5f00\u7ec8\u7aef\uff0c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u767b\u9646\u6210\u529f\u30023.2.\u901a\u8fc7\u66f4\u6539grub\u5f15\u5bfc\u4e2d\u7684\u5185\u6838\u53c2\u6570\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u513f\u6309\u7167\u5728grub\u5f15\u5bfc\u83dc\u5355\u4e2d\u4f7f\u7528\u7684\u5185\u6838\u53c2\u6570\u4e0d\u540c\uff0c\u53c8\u5206\u4e3a\u4e24\u79cd\u5f62\u5f0f\uff0c\u8fd9\u4e24\u79cd\u65b9\u6cd5\u4e0d\u5c48\u4ece\u4e8e\u5177\u4f53\u7684\u53d1\u884c\u7248\uff0c\u53ea\u8981\u662f\u91c7\u7528GRUB2\u5f15\u5bfc\u7684Linux\u7cfb\u7edf\uff0c\u7406\u8bba\u4e0a\u90fd\u53ef\u4ee5\u4f7f\u7528\u4e0b\u8fb9\u7684\u4e24\u79cd\u5f62\u5f0f\u5b9e\u73b0root\u7528\u6237\u5bc6\u7801\u91cd\u7f6e\u3002\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.2.1.\u901a\u8fc7rd.break\u5185\u6838\u53c2\u6570\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u901a\u8fc7\u5728\u542f\u52a8\u7684\u65f6\u4faf\uff0c\u51fa\u73b0GRUB\u7684\u5f15\u5bfc\u83dc\u5355\u7684\u65f6\u4faf\uff0c\u6309e\u952e\u5373\u53ef\u7f16\u8f91\u5185\u6838\u9009\u9879\u3002\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u518d\u4e0a\u56fe\u6309e\u952e\uff0c\u6b65\u5165\u53f3\u56fe\u6240\u793a\u754c\u9762\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u7684linux\u5f00\u59cb\u7684\u884c\u4e2d\uff0c\u5c06\u672b\u5c3e\u7684rhgbquit\u53bb\u9664\uff0c\u4e4b\u540e\u964d\u4f4erd.break\uff0c\u540c\u65f6\u5c06\u539f\u5148\u7684ro\u66f4\u6539\u4e3arw\uff0c\u5c06\u8981\u6839\u5206\u533a\u4ee5\u8bfb\u5199\u7684\u5f62\u5f0f\u6302\u8f7d\u5230\/sysroot\u8fd9\u4e2a\u76ee\u5f55\u4e0a\uff0c\u4e4b\u540e\u6309\u4e0bCtrl+x\u952e\u5373\u53ef\u7ee7\u7eed\u542f\u52a8\u7cfb\u7edf\uff0c\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u53f3\u56fe\u4e2d\u6309\u4e0bCtrl+d\u952e\uff0c\u5373\u53ef\u6b65\u5165shell\u4ea4\u4e92\u547d\u4ee4\u884c\uff0c\u56e0\u4e3a\u6b64\u65f6\u7cfb\u7edf\u771f\u6b63\u7684\u6839\u5206\u533a\u6302\u8f7d\u5728\/sysroot\u4e0a\uff0c\u6240\u4ee5\u987b\u8981\u5c06\u5176\u4ee5\u8bfb\u5199\u7684\u5f62\u5f0f\u91cd\u65b0\u8fdb\u884c\u6302\u8f7d\uff0c\u4e4b\u540e\u6267\u884c\u547d\u4ee4chroot\/sysroot\u5207\u6839\uff0c\u6b64\u65f6\u7684\u4e0a\u4e0b\u6587\u73af\u5883\u624d\u662f\u771f\u6b63\u7684\u6839\u5206\u533a\u3002\u4e4b\u540e\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u547d\u4ee4passwdroot\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801\u3002\u5047\u5982\u539f\u5148\u7684\u7cfb\u7edf\u6ca1\u6709\u5f00\u542fSELinux\u7684\u8bdd\uff0c\u8fd9\u4e48\u6b64\u65f6\u6267\u884cexit\u9000\u51fa\u5207\u6839\u73af\u5883\uff0c\u5e76\u8f93\u5165reboot\u547d\u4ee4\u91cd\u542f\u7684\u8bdd\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5bc6\u7801\u91cd\u7f6e\u7684\u64cd\u4f5c\u4e86\u3002\u4f46\u56e0\u4e3a\u6211\u8fd9\u4e2aFedora\u662f\u65b0\u5b89\u88c5\u7684\u7cfb\u7edf\uff0c\u4e14\u5e76\u6ca1\u6709\u5173\u6389SELinux\uff0c\u6240\u4ee5\uff0c\u8fd8\u987b\u8981\u518d\u6267\u884c\u4e00\u4e0btouch\/.autorelabel\u8fd9\u4e2a\u547d\u4ee4\uff0c\u63d0\u793aSELinux\u91cd\u65b0\u52a0\u8f7d\u6807\u7b7e\u3002\u5728\u4e0a\u6b21\u91cd\u542f\u7684\u65f6\u4faf\uff0c\u5047\u82e5\u7cfb\u7edf\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u6587\u4ef6\u597d\u591a\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u6240\u987b\u8981\u7684\u65f6\u95f4\u4f1a\u6bd4\u8f83\u957f\u3002\u91cd\u542f\u4ee5\u540e\uff0c\u8f93\u5165root\u7528\u6237\u540d\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u91cd\u7f6e\u540e\u7684\u5bc6\u7801\u8fdb\u884c\u767b\u9646\u4e86\u3002\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u5fd8\u6389\u4e0a\u56fe\u4e2d\u6839\u5206\u533a\u88ab\u6302\u8f7d\u5230\u90a3\u4e2a\u76ee\u5f55\u4e0b\uff0c\u53ef\u4ee5\u5728\u4e0a\u56fe\u7684\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u547d\u4ee4mount\uff0c\u5373\u53ef\u663e\u793a\u51fa\u6839\u76ee\u5f55\u6302\u8f7d\u7684\u8def\u5f84\u3002\u4e0a\u56fe\u91cd\u542f\u5b8c\u4ee5\u540e\uff0c\u8f93\u5165root\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u91cd\u7f6e\u540e\u7684\u5bc6\u7801\u767b\u5165\u7cfb\u7edf\u4e86\u3002\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u56fe\u662fSELinux\u6253\u6807\u7b7e\u7684\u8fc7\u7a0b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u81f3\u6b64\uff0c\u901a\u8fc7\u66f4\u6539grub\uff0c\u964d\u4f4erd.break\u8fd9\u4e2a\u5185\u6838\u53c2\u6570\u5b9e\u73b0\u7684root\u5bc6\u7801\u91cd\u7f6e\u64cd\u4f5c\u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.2.2.\u901a\u8fc7init\u5185\u6838\u53c2\u6570\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e9b\u65b9\u6cd5\u6574\u4f53\u6d41\u7a0b\u8ddf\u4e0a\u4e00\u79cd\u65b9\u6cd5\u7c7b\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u662f\u4f7f\u7528\u7684init\u8fd9\u4e2a\u5185\u6838\u53c2\u6570\uff0c\u66f4\u6539\u767b\u5165\u8fc7\u7a0b\u4e2d\u7684shell\u7c7b\u5e93\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728grub\u7684\u5f15\u5bfc\u83dc\u5355\u4e2d\uff0c\u5c06linux\u5f00\u5934\u7684\u884c\u4e2d\u7684ro\u66f4\u6539\u4e3arw\uff0c\u4e4b\u540e\u53bb\u9664\u672b\u5c3e\u7684rhgbquiet\uff0c\u4e4b\u540e\u964d\u4f4einit=\/sysroot\/bin\/bash\uff0c\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e0a\u56fe\u4e2d\u6309\u4e0bCtrl+x\u7ee7\u7eed\u542f\u52a8\u7cfb\u7edf\uff0c\u5728\u53f3\u56fe\u4e2d\u6309\u4e0bCtrl+d\u6b65\u5165\u5230\u6211\u4eec\u5728\u5185\u6838\u624b\u6307\u5b9a\u7684shell\u7c7b\u5e93\u4ea4\u4e92\u754c\u9762\uff0c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6b65\u5165\u5230shell\u4ee5\u540e\uff0c\u6267\u884cchroot\/sysroot\u547d\u4ee4\u5207\u6839\uff0c\u4e4b\u540e\u6267\u884c\u547d\u4ee4passwdroot\u66f4\u6539root\u7528\u6237\u7684\u767b\u9646\u5bc6\u7801linux\u4e3b\u673a\uff0c\u5047\u5982\u539f\u5148\u7684\u7cfb\u7edf\u4e2d\u6ca1\u6709\u5f00\u542fSELinux\uff0c\u8fd9\u4e48\u6b64\u65f6\u6267\u884cexit\u9000\u51fa\u5207\u6839\u73af\u5883\uff0c\u5e76\u6267\u884creboot\u91cd\u542f\u5373\u53ef\u5b8c\u6210root\u7528\u6237\u5bc6\u7801\u91cd\u7f6e\u7684\u64cd\u4f5c\u3002\u5e76\u4e14\u56e0\u4e3a\u6211\u7684Fedora34\u662f\u65b0\u5b89\u88c5\u7684\u7cfb\u7edf\uff0c\u5e76\u672a\u7981\u7528SELinux\uff0c\u6240\u4ee5\uff0c\u6b64\u65f6\u5fc5\u9700\u8981\u6267\u884ctouch\/.autorelabel\u547d\u4ee4\u7ed9\u66f4\u6539\u540e\u7684\u6839\u5206\u533a\u4e2d\u7684\u914d\u7f6e\u6587\u4ef6\u91cd\u65b0\u6253\u6807\u7b7e\u624d\u53ef\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002\u5047\u5982\u7701\u7565\u6389\u8fd9\u6b65\uff0c\u800c\u7cfb\u7edf\u53c8\u521a\u597d\u5f00\u542f\u4e86SELinux\uff0c\u8fd9\u4e48\u4e0a\u8ff0\u7684\u5bc6\u7801\u91cd\u7f6e\u64cd\u4f5c\u65f6\u4e0d\u4f1a\u751f\u6548\u7684\u3002\u5177\u4f53\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>SELinux\u7ed9\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u6253\u6807\u7b7e\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5386\u65f6\u957f\u77ed\u53d6\u51b3\u4e8e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u6587\u4ef6\u7684\u591a\u5c11\uff0c\u6587\u4ef6\u8d8a\u591a\uff0c\u5386\u65f6\u8d8a\u957f\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u81f3\u6b64\uff0croot\u7528\u6237\u5bc6\u7801\u91cd\u7f6e\u7684\u64cd\u4f5c\u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>4.ReferencesAnintroductiontotheLinuxbootandstartupprocessessystemdbootupFile:GNUGRUBonMBRpartitionedharddiskdrives.svgRed_Hat_Enterprise_Linux-7-System_Administrators_Guide-en-US.pdf<\/p>\n","protected":false},"excerpt":{"rendered":"<p>name.service\u547d\u4ee4\u8fdb\u884c\u91cd\u65b0\u88c5\u8f7d\u914d\u7f6e\u6587\u4ef6\u6216\u8005\u5bf9\u5df2\u7ecf\u8fd0\u884c\u7684\u670d\u52a1\u5355\u5143\u8fdb\u884c\u91cd\u542f\u7684\u64cd\u4f5c\u30027.x\u5f00\u59cb\uff0c\u7531systemd\u63d0\u4f9b\u7cfb\u7edf\u7684\u7535\u6e90\u7ba1\u7406\u547d\u4ee4\u3002\u901a\u8fc7\u4fee\u6539grub\u5f15\u5bfc\u4e2d\u7684\u5185\u6838\u53c2\u6570\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n","protected":false},"author":1,"featured_media":18324,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[23,128,434,804,623],"class_list":["post-18323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-lxt","tag-lcqml","tag-s-14","tag-s-23","tag-t-8"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/18323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=18323"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/18323\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media\/18324"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=18323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=18323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=18323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}