Try to redirect the output in order to see what happens. I suspect that sudo refuses to run if it detects that it is not ran via a terminal of some sort. Alternative could be to flag your executable suid (run as owner):
Redirection:
echo ”some password” | sudo –S somecommand > /tmp/log.stdout 2> /tmp/log.stderr
Suid:
#only make directory accessable by owner (user)
chmod 700 /home/user/bin
#set owner of yourprogram to root
chown root /home/user/bin/yourprogram
#set setuid flag on yourprogram
chmod u+s /home/user/bin/yourprogram
Stian Skjelstad
Fra: nautilus-list-bounces gnome org [mailto:nautilus-list-bounces gnome org] På vegne av Mark S. Townsley
Sendt: 24. juni 2011 23:36
Til: nautilus-list gnome org
Emne: sudo and nautilus
Hi:
I am using Nautilus file browser (version 2.30.0).
I have written a C++ program, compiled. Part of that use system() C api to execute a bash script. The bash script does
echo "some password" | sudo -S <some executable>
The executable runs fine. But if I run from nautilus, it never gets to call that system() line. I tried creating the bash script dynamically right before system() is called and the script is created. From within the script, I tried to write a file but it never happens. So I know the script is not called.
If I execute the script directly from Nautilus, it works though.
What am I missing? Calling an executable that in turn calls another executable is not allowed in Nautlius?
Thanks for any tips.
Mark