Run a command on startup in Kali

13,022

Create a script that runs the command you need, and change the permissions with:

chmod 755 /path/to/the/script

Then run:

update-rc.d /path/to/the/script defaults

To remove the script:

update-rc.d -f  /path/to/the/script remove
Share:
13,022

Related videos on Youtube

Cecemel
Author by

Cecemel

Updated on September 18, 2022

Comments

  • Cecemel
    Cecemel over 1 year

    I have kali installed on a Raspberry Pi Zero, I control it using VNC from my iPad but I need a way to get them both on the same network for that. I would like to run the following command on startup to create an access point that I can connect to from my iPad.

    /root/create_ap/create_ap -n wlan1 MyAP
    

    I know the internet may be full of articles on how to do this but I just can't seem to get it to work. It would be nice if someone could give me some simple, straightforward instructions.

    • iainpb
      iainpb about 7 years
      Suggest you post this to the Unix & Linux Stack Exchange as it's not a security topic aside from the fact you are using Kali. It'll probably be closed as off topic soon.
    • ThoriumBR
      ThoriumBR about 7 years
      @iain is right, I am voting to migrate your question to SuperUser.
  • Cecemel
    Cecemel about 7 years
    When I enter "update-rc.d AutoAP.sh defaults" I get: "update-rc.d: error: initscript does not exist: /etc/init.d/AutoAP.sh"..
  • Cecemel
    Cecemel about 7 years
    So.. I guess I fixed it. Instead of running your command, I just opened the rc.local (etc/rc.local) file using nano and added the line manually. Thanks!