本网站(662p.com)打包出售,且带程序代码数据,662p.com域名,程序内核采用TP框架开发,需要联系扣扣:2360248666 /wx:lianweikj
精品域名一口价出售:1y1m.com(350元) ,6b7b.com(400元) , 5k5j.com(380元) , yayj.com(1800元), jiongzhun.com(1000元) , niuzen.com(2800元) , zennei.com(5000元)
需要联系扣扣:2360248666 /wx:lianweikj
kali添加开机自启的方法
iamgeek · 184浏览 · 发布于2022-09-27 +关注

采用systemd的方法,kali默认是没有rc.local的,需要自己创建。本方法也适用于ubuntu 18.04 64bit,对kali添加开机自启知识感兴趣的朋友一起看看吧


kali添加开机自启

采用systemd的方法,kali默认是没有rc.local的,需要自己创建。本方法也适用于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]复制最下面的[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

创建/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

注意,注释到执行代码这片区域中间不要有空行。不然该服务会将空行当命令执行,所以就会报错。命令后面我加上& 是表示在后台执行

设置执行权限

sudo chmod a+x /etc/rc.local

检查脚本是否正确

含义分别是重载服务,启动服务,查看服务状态

sudo systemctl enable rc-local
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service

可能出现的问题

  • 出现active,但是下面日志出现报错

则你的systemd服务顺利执行了。但是你的/etc/rc.local脚本有问题。自己执行下这个命令看看能不能正确执行该脚本。不能那就检查脚本代码,注意不要出现空行。重新检查文件执行权限

./etc/rc.local
  • 没显示active

那么就是你的/etc/systemd/system/rc-local.service 写的不对。重新检查下,特别是[install]部分

到此这篇关于kali添加开机自启的文章就介绍到这了,



    相关推荐

    PHP实现部分字符隐藏

    沙雕mars · 1312浏览 · 2019-04-28 09:47:56
    Java中ArrayList和LinkedList区别

    kenrry1992 · 896浏览 · 2019-05-08 21:14:54
    Tomcat 下载及安装配置

    manongba · 957浏览 · 2019-05-13 21:03:56
    JAVA变量介绍

    manongba · 953浏览 · 2019-05-13 21:05:52
    什么是SpringBoot

    iamitnan · 1077浏览 · 2019-05-14 22:20:36
    加载中

    0评论

    评论
    努力追求卓越,极致,这么一个GEEK人,希望可以跟大家认识,交流一下。
    分类专栏
    小鸟云服务器
    扫码进入手机网页