How can I get hostapd_cli to work under sudo on debian stretch?
1
vote
1
answer
1067
views
I have a bash script that runs
hostapd_cli all_sta
, and the script executes successfully from the command line under both jessie and stretch. The script also works when run under sudo on jessie but not on stretch. On stretch the command times out with the error 'STA-FIRST' command timed out
. When I invoke hostapd_cli under strace I see that it opens a socket file under /tmp
:
bind(3, {sa_family=AF_UNIX, sun_path="/tmp/wpa_ctrl_13552-1"}, 110) = 0
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/hostapd/wlan1"}, 110) = 0
As a test I temporarily modified the script and added a line:
echo "this is a test" >/tmp/test 2>/root/error
When the modified script runs under sudo, the file in /tmp
is not created and no error is written to /tmp/error
.
On my system, /tmp
is not a tmpfs, just a plain old directory under /
on an ext3 filesystem. So root is unable to create a file under /tmp
and there is ample space.
# df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sdb2 6.7G 5.1G 1.4G 80% /
And an ls -ld /tmp
gives:
# ls -ld /tmp
drwxrwxrwt 9 root root 4096 Jul 27 23:50 /tmp/
If I can figure out why /tmp
can't be written to, I believe the hostapd_cli command will work. What could be happening here?
Asked by Bob
(111 rep)
Jul 28, 2017, 05:07 AM
Last activity: Aug 5, 2020, 06:56 PM
Last activity: Aug 5, 2020, 06:56 PM