I have some bash scripts that I use with the user 'root' to manage iptable rules.  The problem is that I want these things at the same time:   The script must be owned by root Permissions must be 700 I want to have an executable binary that certain user can execute. This executable will run the mentioned script as root.   This used to work, and is still what I use in older distributions:  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/types.h&gt; #include &lt;unistd.h&gt;  int main() {    setuid(0);    system("/root/iptables/my-iptables-script.sh");     return 0; }   So I compile this and then use sudo chown root and sudo chmod 4777. This way the user can now execute the binary and run the script owned by root.  But now I installed Ubuntu 13.10 and when I run that binary I get "permission denied" for the script.  Is it possible that something changed in this respect since 12.04?  What can I do?
The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:  &gt; cat setuid-test.c  #include &lt;stdio.h&gt; #include &lt;unistd.h&gt;  int main(int argc, char** argv) {     printf("%d", geteuid());     return 0; }  &gt; gcc -o setuid-test setuid-test.c &gt; ./setuid-test  1000  &gt; sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test &gt; ./setuid-test  65534   However, this only applies to executables; shell scripts ignore the setuid bit:  &gt; cat setuid-test2  #!/bin/bash id -u  &gt; ./setuid-test2  1000  &gt; sudo chown nobody ./setuid-test2; sudo chmod +s ./setuid-test2 &gt; ./setuid-test2  1000     Wikipedia :     Due to the increased likelihood of security flaws, many operating systems ignore the setuid attribute when applied to executable shell scripts.   Assuming I'm willing to accept those risks, is there any way to tell Linux to treat the setuid bit the same on shell scripts as it does on executables?  If not, is there a common workaround for this problem? My current solution is to add a sudoers entry to allow ALL to run a given script as the user I want it run as, with NOPASSWD to avoid the password prompt. The main downsides to that is the need for a sudoers entry every time I want to do this, and the need for the caller to sudo some-script instead of just some-script
Cannot find Underground Jungle Temple On my 1.2 Terraria Map I have been mining from left to right in my large underground jungle using my rocket launcher. Despite this, I have had no luck on finding the Underground Jungle Lihzahrd Temple. I have been searching the layer above where lava constantly spawns. Have I simply spawned in a world without one or am I searching in the wrong place? I have also considered using the clentimator with Dark Blue ammo to provide light, should I do that? The first and (the) second chapter(s) are difficult - which is correct? I'm a little confused about the following sentences. Could you please tell me which one(s) is/are correct?        The first and the second chapter are difficult.   The first and the second chapters are difficult.   The first and second chapters are difficult.   The first and second chapter are difficult.      I believe #1 &amp; #3 are correct, while #2 &amp; #4 are incorrect.  But when seeing the answers to the Quora question , I wonder why they say #2 is correct. My regex is matching too much. How do I make it stop? There are infinitely many prime numbers $p$ for which $p + 2$ and $p + 4$ are also prime numbers I need help with this question: There are infinitely many prime numbers $p$ for which $p + 2$ and $p + 4$ are also primes.  Where should I start? what proof techniques will be useful?  Any input will be very useful to me. present continous or present perfect continous? Should I write 'I have been reading a book now' or 'I am reading a book now'? I started to read one week ago and I haven't ended yet. Thanks for help In PHP, is there an easy way to convert a number to a word? For instance, 27 to twenty-seven. Group cohomology intuition Group cohomology is one thing I don't seem to get my head around.  I understand $H^0$ as being the "fixed points" but when it comes to anything higher I have no idea what the notions are meant to be capturing...if anything.  For example I can see that 1-cocycles are homomorphisms with a specific property but that property doesn't seem to mean anything to me...and I think it should!  Is there an intuition or example that explains the meaning or is it just something that "stuck" and seems to work in lots of places? Performance of try-catch in php What kind of performance implications are there to consider when using try-catch statements in php 5?   I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of the niceties of php 5. So, I don't have much experience myself in using try-catchs with php. Encouraging users to create an account (and keep it) Tikzpictures side by side Why is the image of a smooth embedding $f: N \to M$ an embedded submanifold? I'm reading An Introduction to Manifolds (Tu) and got confused on p.123 Theorem 11.13. Let me briefly explain what was done before that.  The author defines an embedding between two manifolds $f: N\rightarrow M$ as an injective immersion (differential is injective everywhere) with the additional property that $f(N)$ as a subspace of $M$ is homeomorphic via $f$ to $N$. Then a canonical form theorem is proven, namely, that for any point $p \in N$, there are charts $(U,\phi = x^1, \ldots, x^n) \ni p$ and $(V,\psi = y^1, \ldots, y^m) \ni f(p)$, such that the transition map takes the following form:  $$\psi \circ f \circ \phi^{-1} : (r^1,\ldots,r^n) \mapsto (r^1,\ldots,r^n,0,\ldots,0).$$  (I guess it is implicitly assumed that $f(U) \subset V$).  Now in the process of proving that $f(N) \subset M$ is an , he states that $f(U) \subset V$ is defined by the vanishing of the coordinates $y^{n+1},\ldots,y^m$. I can prove that $$ f(U) \subset \{q \in V: y^{n+1}(q) = \cdots = y^m(q)\} $$ but not the reverse inclusion. Can anyone explain why this should be true? If the earth would stop spinning, what would happen? What is a "Swap Area"? So I noticed this question has not been asked directly;  What is this "Swap Area" people keep referring to when it comes to installing Ubuntu? Getting javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher? Converting string arrays into Map Record Animation In BGE I run a guest ubuntu 12.04 on a host ubuntu 12.04, with VirtualBox, and the guest is much, much slower than the host (ALT+TAB takes 4-5 secs). I had a look around and I found contradicting opinions on VirtualBox versus VMware (free); so I thought to keep the former.   Both systems are updated, I installed the additions on the guest and I evenly split memory and video memory (64MB) between guest and host. I am running a Toshiba m200 laptop with 4GB ram and shared video memory. The host bios does not include a configuration option for machine virtualization. I have 2 cpus and I can't give them both to the virtual machine.  Is there anything I overlooked that could solve my problem?  Feel free to ask for more info, and thank you for any help.  EDIT Idling with the system monitor open the (single) guest cpu never gets below 55% and could rise to 80 - 90% just by moving the mouse around. Opening Firefox will cause the system monitor to show cpu usage 100% in the guest, while the host shows that both cpus are evenly working around 60%.  My cpu is Intel® Core™2 Duo CPU T5450 @ 1.66GHz × 2.  If this is not a configuration problem, does it mean my machine is too weak for virtualization? Moving from SQL 2005 [SQL_Latin1_General_CP1_CI_AS] to 2008 - will I lose any features by using 'backwards compatibility' I'm studying Quantum Mechanics and I came across this which I don't quite understand: For a vector space of functions $f(x)$ to be square integrable (i.e $\int{|f(x)|^2dx &lt; \infty)}$, the necessary condition is $\lim_{|x| \to \infty}f(x) \to 0$. Can someone help me understand why that must be the case? I sort of understand that it must not blow up at the infinities but can a (continuous or piece-wise continuous) function have a non-zero finite value at the infinities and still be square integrable? If $A=\left( \begin{array}{ccc} 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; 1 \\ 1 &amp; 0 &amp; 0 \end{array} \right)$, find the rank of $A+A^2+A^3$  We have $\rho(A+A^2+A^3)\leq\rho(A)+\rho(A^2)+\rho(A^3) $ where $\rho(A)$ means rank of A.  Here $\rho(A)=3.$ Also $\rho(A^2)=3$ and $\rho(A^3)=3$  as $\det A\neq 0$ and $\det(A^2)=\det(A)\det(A)\neq 0$ and so on.   But how to get the desired result.