Re: sudo and nautilus



Hi Stian:

Thanks for your reply.  Following your mechanism, stderr contains one line that says I need a real tty.

Essentially because of this:

http://www.pinoytux.com/linux/sudo-error-sorry-you-must-have-a-tty-to-run-sudo

I like suid that you suggested but I am not able to chown something to root unless I am root.

Not sure what else I can do if I just need users to temporarily gain hold of root access from nautilus.



Mark




On Sat, Jun 25, 2011 at 5:31 AM, Stian Skjelstad <stian nixia no> wrote:

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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]