新聞中心
非Root用戶禁用服務(wù)器的方法有很多,這里介紹一種簡(jiǎn)單的方法:使用systemctl命令,以下是詳細(xì)步驟:

石首網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),石首網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為石首1000多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的石首做網(wǎng)站的公司定做!
1、安裝systemd:
對(duì)于Debian/Ubuntu系統(tǒng),使用以下命令安裝:
“`
sudo aptget update
sudo aptget install systemd
“`
對(duì)于CentOS/RHEL系統(tǒng),使用以下命令安裝:
“`
sudo yum install systemd
“`
2、創(chuàng)建一個(gè)名為disable_server.service的配置文件,將其放在/etc/systemd/system/目錄下:
“`
sudo nano /etc/systemd/system/disable_server.service
“`
3、在打開(kāi)的文件中,輸入以下內(nèi)容:
“`
[Unit]
Description=Disable Server
After=network.target
[Service]
ExecStart=/bin/true
RemainAfterExit=true
[Install]
WantedBy=multiuser.target
“`
4、保存并關(guān)閉文件。
5、重新加載systemd配置:
“`
sudo systemctl daemonreload
“`
6、啟用disable_server.service服務(wù):
“`
sudo systemctl enable disable_server.service
“`
7、現(xiàn)在,當(dāng)你嘗試重啟服務(wù)器時(shí),它將自動(dòng)進(jìn)入單用戶模式并執(zhí)行/bin/true命令,這將阻止服務(wù)器重新啟動(dòng),要恢復(fù)服務(wù)器功能,只需禁用disable_server.service服務(wù)并重啟服務(wù)器即可:
“`
sudo systemctl disable disable_server.service
sudo reboot
“`
本文名稱:非Root用戶如何禁用服務(wù)器?(不root禁用服務(wù)器)
分享網(wǎng)址:http://fisionsoft.com.cn/article/coigphj.html


咨詢
建站咨詢
