emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Is it possible to run shell script src blocks as root or to expo


From: Nick Dokos
Subject: Re: [O] Is it possible to run shell script src blocks as root or to export individual blocks?
Date: Sat, 03 Mar 2012 03:55:12 -0500

Leo Alekseyev <address@hidden> wrote:

> I was wondering if there was an easy way to execute some shell
> commands contained in a src block as root.  Alternatively, is there a
> quick way to export _just_ that one source block to a temp file so
> that I could run it as root manually?
> 

You could set up sudo so that it does not require a password and prefix each
command that needs to be run as root with "sudo":

--8<---------------cut here---------------start------------->8---

* foo

#+BEGIN_SRC sh
sudo id

#+END_SRC

#+RESULTS:
: uid=0(root) gid=0(root) groups=0(root)
--8<---------------cut here---------------end--------------->8---

Not sure how sudo would interact with babel if you had to type in a password.

Nick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]