Closed maverick85 closed 2 years ago
`setcap cap_net_raw+ep /usr/local/sbin/mtr-packet` \
|| chmod u+s /usr/local/sbin/mtr-packet
is meant to make mtr-packet setuid-root if the setcap program cannot be found. Your log shows that setcap wasn't found so it should have made the binary "setuid-root".
The runtime errors indicate that this somehow didn't work. Please send the output of "ls -l /usr/local/sbin/mtr-packet"
Hi @rewolff thank you for your reply.
mtr-0.94 % ls -l /usr/local/sbin/mtr-packet
-rwsr-xr-x 1 maverickws admin 77192 Dec 20 17:53 /usr/local/sbin/mtr-packet
mtr-0.94 %
OK. So it DID become setuid, but has YOUR userid, not that of "root".
Become root ("sudo -s" does that on my system, but not sure about macos). Then chown root.root /usr/local/sbin/mtr-packet
This will change the owner to what we want, but as a security precaution it will probably drop the setuid bit, so we have to set that again: chmod u+s /usr/local/sbin/mtr-packet
Hopefully it'll work after that.
As I mentioned I restored the previous build using Time Machine simply restored the /usr/local
folder.
Following on your comment I listed the folder sbin
to check for differences. It's owned by the user too, just the permissions are slightly different:
~ % ls -la /usr/local/sbin
total 7696
drwxr-xr-x 8 maverickws admin 256 Feb 24 2021 .
drwxr-xr-x 16 root wheel 512 Dec 20 18:02 ..
-rwxr-xr-x 1 maverickws admin 81628 Nov 29 2019 mtr
-rwxr-xr-x 1 maverickws admin 41912 Nov 29 2019 mtr-packet
@rewolff
I redid the whole thing, then:
chmod u-s /usr/local/mtr-packet
And its fixed, working again. Owned by user/user group and attributes set the same as the previous version.
Weird. There is certanly something going on that I don't expect.
I suppose the setuid bit makes the file always be ran with the userid of the file owner ... in this case mine (maverickws:admin). I assume if I changed the ownership to root, that probably would fix it too, but I always use sudo with mtr (well, actually I have an alias for mtr='sudo mtr') so I guess the flag was forcing the executable to be ran with my user instead of root from the sudo.
I figure that changing the ownership to root:admin and adding the setuid flag would also work.
In any case I have done a guide to build mtr from source on the mac, and updated with the method of removing the setuid flag. Hopefully if anyone has the same issue, this thread will help them sort it (one way or the other)! Thank you!
ohhhh. I thought that it still didn't work after you followed my instructions. That explains everything. The world is consistent again. Thanks for the update.
Hello,
Building from sources on macOS is failing to start. The full output:
I had mtr-0.92 built from the sources working fine. After failing to put 0.94 to work, I used time machine to restore the previous build which is working.