網(wǎng)站首頁 編程語言 正文
kali添加開機自啟
采用systemd
的方法,kali默認是沒有rc.local
的,需要自己創(chuàng)建。本方法也適用于ubuntu 18.04 64bit
改寫rc-local.service 文件
先從lib中拿出模板文件進行更改
sudo cp /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
再vim修改
sudo vim /etc/systemd/system/rc-local.service
主要是添加[install]
復(fù)制最下面的[install]即可
# SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.local is executable. [Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no [Install] WantedBy=multi-user.target
創(chuàng)建/etc/rc.local文件
sudo vim /etc/rc.local
#!/bin/bash #!/bin/bash # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /home/ki/桌面/frp_0.36.2_linux_amd64/frpc -c /home/ki/桌面/frp_0.36.2_linux_amd64/frpc.ini & exit 0
注意,注釋到執(zhí)行代碼這片區(qū)域中間不要有空行。不然該服務(wù)會將空行當(dāng)命令執(zhí)行,所以就會報錯。命令后面我加上&
是表示在后臺執(zhí)行
設(shè)置執(zhí)行權(quán)限
sudo chmod a+x /etc/rc.local
檢查腳本是否正確
含義分別是重載服務(wù),啟動服務(wù),查看服務(wù)狀態(tài)
sudo systemctl enable rc-local sudo systemctl start rc-local.service sudo systemctl status rc-local.service
可能出現(xiàn)的問題
- 出現(xiàn)active,但是下面日志出現(xiàn)報錯
則你的systemd
服務(wù)順利執(zhí)行了。但是你的/etc/rc.local
腳本有問題。自己執(zhí)行下這個命令看看能不能正確執(zhí)行該腳本。不能那就檢查腳本代碼,注意不要出現(xiàn)空行。重新檢查文件執(zhí)行權(quán)限
./etc/rc.local
- 沒顯示active
那么就是你的/etc/systemd/system/rc-local.service
寫的不對。重新檢查下,特別是[install]
部分
原文鏈接:https://www.cnblogs.com/beidaxmf/p/14860651.html
相關(guān)推薦
- 2022-10-02 C#利用FileSystemWatcher實時監(jiān)控文件的增加,修改,重命名和刪除_C#教程
- 2022-10-14 ‘configurationClass‘ must be assignable to [org.hi
- 2022-10-29 python的list列表的增加方法運用
- 2023-07-04 在SpringBoot中如何整合數(shù)據(jù)源?
- 2022-05-27 react使用axios進行api網(wǎng)絡(luò)請求的封裝方法詳解_React
- 2024-04-03 linux系統(tǒng)配置nginx兩套以上的前端
- 2022-08-21 python深度學(xué)習(xí)tensorflow安裝調(diào)試教程_python
- 2022-10-11 C語言超詳細分析多進程的概念與使用_C 語言
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支