I am trying to run airodump
in the background.. I wrote the following script thats called from /etc/rc.local
:
#!/bin/bash
/usr/local/sbin/airmon-ng check kill >> /tmp/airmon-kill 2>&1
sleep 2
/usr/local/sbin/airmon-ng start wlan0 > /tmp/airmon-start 2>&1
sleep 2
/usr/local/sbin/airodump-ng wlan0mon --manufacturer --uptime --wps --output-format csv --write-interval 5 --write log > /tmp/airmon-dump 2>&1&
When I run these commands as root from the terminal they work fine. When I run them from rc.local
I get all kind of issues..
First the kill script.. this one seems to work fine since the output is:
Killing these processes:
PID Name
2294 dhcpcd
Next the start script... thats where I get an error that I don't get when I run it on the terminal myself:
PHY Interface Driver Chipset
phy0 mon.wlan0 rt2800usb Ralink Technology, Corp. RT5370
phy0 wlan0 rt2800usb Ralink Technology, Corp. RT5370
Error setting channel: command failed: Device or resource busy (-16)
Error -16 likely means your card was set back to station mode by something.
Removing non-monitor mon.wlan0 interface...
WARNING: unable to start monitor mode, please run "airmon-ng check kill"
Any ideas why the behaviour is so different? Both run as root (I checked that) and both run from bash. Why the different behaviour?