schollz / find3-cli-scanner

The command-line scanner that supports Bluetooth and WiFi
https://www.internalpositioning.com/doc/tracking_your_computer.md
149 stars 55 forks source link

Bug: cli-scanner docker on mac needs sudo #19

Closed diplix closed 6 years ago

diplix commented 6 years ago

installed the cli-scanner docker container on os x (tried high sierra and el capitan), but after trying to scan:

ix:~ ix$ docker exec scanner sh -c "find3-cli-scanner -i en0 -device ixbook -family test -server http://192.168.1.57:8005 -scantime 10 -location kueche"

it complains:

2018-07-28 10:52:37 [ERROR] main.go main:206 need to run with sudo

of course docker exec scanner sh -c "sudo find3-cli-scanner … does not work

also:

ix:~ ix$ docker run --net="host" --privileged --name scanning -i -t schollz/find3-cli-scanner /bin/bash
root@linuxkit-025000000001:/# find3-cli-scanner 
2018-07-28 11:11:19 [ERROR] main.go main:206 need to run with sudo 
root@linuxkit-025000000001:/# sudo
bash: sudo: command not found

Specifications

schollz commented 6 years ago

Yeah I know why - its this line: https://github.com/schollz/find3-cli-scanner/blob/master/main.go#L158-L162

Its not detecting "SUDO" in docker. I think probably a check to check if the user is "root" would work, as Docker runs as root.

victorhooi commented 6 years ago

I seem to have hit this issue as well - this is running on Raspberry PI 3+ B.

pi@rp3-entrance:~/scanner $ docker run --net="host" --privileged --name scanning -d -i -t schollz/find3-cli-scanner
c47c0bd9d64d9cc683818c5f46c0ad14b006a75ca9cdb9767cbb6174b74463d7
pi@rp3-entrance:~/scanner $ docker exec scanning sh -c "find3-cli-scanner -i wlan1 -debug -monitor-mode"
2018-07-28 23:14:12 [ERROR] main.go main:206 need to run with sudo
schollz commented 6 years ago

Should be fixed now