Saturday, May 11, 2013

Deep magic from the before the dawn of time

If you ever found yourself wanting to execute a sudo(1) command from within block of shell code in a org-bable source code block on a linux system (sure, happens all the time, right?), here's the deep foo to solve the password prompting quandry:

Sylvain Rousseau | 4 Mar 2012 18:29
  
 
Re: Is it possible to run shell script src blocks as root or to export individual blocks?

Under Gnome, I'm using this at the beginning of a sh source block:

 echo -e "#! /bin/bash\n/usr/bin/gksudo -p -m Password" > /tmp/gksudo-stdout
 chmod +x /tmp/gksudo-stdout
 SUDO_ASKPASS="/tmp/gksudo-stdout" sudo -A -s


Sylvain.

http://comments.gmane.org/gmane.emacs.orgmode/52979

No comments:

Post a Comment