Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The ps output gives you a clue. The thing you're running is bash with your script as an argument. Since bash isn't suid, it can't elevate permissions.</p> <p>Linux - and most unixes - don't allow suid shell scripts either way. It's implemented as part of the exec() system call that they ignore suid/sgid on anything being interpreted through the #! mechanism (see <code>man execve</code>). To work around this, you'll most likely want to use sudo and potentially call it from within your shell script (which is somewhat safer anyway).</p> <p>To run part of the script using sudo, you would use the -u or -g options to sudo to launch your script. So, you'd make a rule in /etc/sudoers (which is beyond the scope of this answer) allowing you to run the script. Say your script is /tmp/script, and you're abc. to run the command as the user "sauer" without being prompted for your password, you'd add this to /etc/sudoers:</p> <pre><code>abc ALL = (sauer) NOPASSWD: /tmp/script </code></pre> <p>and run this command</p> <pre><code>sudo -u sauer /tmp/script </code></pre> <p>To run it as a member of the admin group, you'd add this line:</p> <pre><code>abc ALL = (%admin) NOPASSWD: /tmp/script </code></pre> <p>and run this command</p> <pre><code>sudo -g admin /tmp/script </code></pre> <p>Read the sudoers man page and surf around Google to find more documentation on sudo. You combine users and groups with commas in that parenthetical expression (ie, <code>(sauer,root,%admin)</code>)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload