You are not logged in.
Hi,
I'm writing a GUI frontend to Netcfg in C++ and am nearing 1.0 version. The problem is that since netcfg needs root privlages, right now it's nessesery to run it using sudo. I'd like the user to be able to run it without sudo, for example in startup scripts. I know it's possible, networkmanger wicd archassistant and every other program of simular nature does it. Can someone point me in the right direction? I searched in google but did not find a good solution.
Offline
Yea I know, but how come all other programs do this automaticly? I don't want to ask users to start editing files.
Offline
wicd and networkmanager for example start without asking the user for the password. They somehow remember it.
Offline
If the frontend is a binary executable (as it must be in this case if you are writing it in C++) then you can use the setuid flag:
https://en.wikipedia.org/wiki/Setuid
http://www.techrepublic.com/blog/securi … urity/2857
For reference, if it is a script (Bash, Python, Lua, etc.) then setuid will not work because it is not the script but rather the interpreter that is executed.
This may also be of interest:
https://wiki.archlinux.org/index.php/Us … _Of_Setuid
Incidentally, I believe that netcfg will soon be replaced by netctl so you may wish to redirect your efforts now to avoid wasting them.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Offline
If the frontend is a binary executable (as it must be in this case if you are writing it in C++) then you can use the setuid flag:
https://en.wikipedia.org/wiki/Setuid
http://www.techrepublic.com/blog/securi … urity/2857For reference, if it is a script (Bash, Python, Lua, etc.) then setuid will not work because it is not the script but rather the interpreter that is executed.
This may also be of interest:
https://wiki.archlinux.org/index.php/Us … _Of_SetuidIncidentally, I believe that netcfg will soon be replaced by netctl so you may wish to redirect your efforts now to avoid wasting them.
Xyne that is most helpfull, thank you. And don't worry, I'm mainly doing it to learn C++ and Gtkmm. Worst case scenerio I change the system calls to netcfg and convery my project (-:
Offline
networkmanager uses a client application that communicates via dbus (using polkit permissions) with a system service.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
[...And don't worry, I'm mainly doing it to learn C++ and Gtkmm. .
Having been bitten (twice) by this, I want to emphasize to anyone reads this, that the setuid *WILL NOT* work with scripts -- by design.
Last edited by ewaller (2013-03-30 16:36:40)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline