Step 1: Create the Script¶
-
Create the backdoor script with the necessary commands and actions:
nano /path/to/your_script.sh
-
Make the script executable.
chmod 755 /path/to/your_script.sh
-
Add the script to the default runlevels so it runs at startup:
update-rc.d /path/to/your_script.sh defaults
Step 2: Verify Script Permissions and Path¶
- Check the script permissions to ensure it is executable by the system:
ls -l /path/to/your_script.sh
- Confirm the script path and the shebang (
#!/bin/bash
) at the top of the script to specify the interpreter.
Step 3: Manual Method – Create a systemd Service (Alternative)¶
-
Create a new service file for your script in the systemd directory.
nano /etc/systemd/system/your_service_name.service
-
Add the following content to the service file:
-
Reload the systemd daemon to recognize the new service.
systemctl daemon-reload
-
Enable the service so it starts on boot.
systemctl enable your_service_name.service
-
Start the service immediately (optional).
systemctl start your_service_name.service
Step 4: Verifying and Troubleshooting¶
- Check the status of your service to ensure it’s running correctly:
systemctl status your_service_name.service
- View logs for any issues or errors.
journalctl -u your_service_name.service
- Check the runlevel symlinks to ensure your script is correctly linked:
ls -l /etc/rc*.d/*your_script.sh