I wrote a python program that needs to call aircrack program to some tasks, but I run into trouble with the privilege. Initially the aircrack program is called in command line, it requires “sudo” at the beginning. After that I checked the location of the executable and found that it locates under /usr/sbin/. Right now my program is driven by apache and the default user is www-data. If I execute the program with user www-data without “sudo”, it won’t give any result.
I googled a little bit on this problem, and found that we can change the owner of aircrack program by executing sudo chmod 4755 /usr/sbin/airodump-ng. I tried it and the privilege is changed from -rwxr-xr-x to -rwsr-xr-x. I executed the command once again without “sudo” but it doesn’t make any difference.
My questions is that: how can I change the privilege of a program so that it can be executed by any user without “sudo”? If I run the program with “sudo”, then the output files are owned by “root”, which adds more complexity to my program. Please help, thanks.
first, none of us can replace the chmod man page (so i’ll start by quoting it):
so, if you want the program to be executable by all users, you ‘chmod 111 file’. however, iirc you need read permissions as well for most things, so ‘chmod 555 file’. also, the reason i’m making the bits the same is because you said you wanted ‘everyone’ to be able to do some.