Note that there are some explanatory texts on larger screens.

plurals
  1. POSet effective group id of Perl script
    primarykey
    data
    text
    <p>I have file permissions issues that I would like to resolve without resorting to making everything world writable.</p> <p>I'm writing files to a NetApp SAN. The directory I'm writing to is owned by the <code>devel</code> user, and has a group of <code>devel</code> with group-writable permissions (<code>0775</code>). The username I'm writing as is in the <code>username</code> and <code>devel</code> groups. </p> <p>The problem appears to be the SAN only checks the first group, so I get permission denied. If I use the <code>newgrp</code> or <code>sg</code> commands to change my group to <code>devel</code>, then I am able to write to the directory.</p> <p>The script attempting to do the writing is written in Perl, but it is started remotely from another machine via ssh and some bash scripting.</p> <p>I cannot change the target directory to be in the <code>username</code> group, because there are other developers and they're in different groups (but we all share the <code>devel</code> group).</p> <p>I cannot make Perl script itself setgid, because we run different environments (devel, test, qa, production, etc) with appropriate groups, and I don't want to manage file permission bits at that level.</p> <p>I cannot use the POSIX <code>setgid</code> function from within the Perl script because it doesn't start as root (and I have no way to ever get root), so I get permission denied. Assigning to <code>$)</code> and <code>$(</code> gives the same result.</p> <p>I cannot use the <a href="http://www.linuxmanpages.com/man1/newgrp.1.php" rel="nofollow noreferrer"><code>newgrp</code></a> command from bash because <code>newgrp</code> doesn't take any arguments, it just starts a new interactive shell (with any following commands executed after the new shell has exited).</p> <p>I also cannot use <a href="http://www.linuxmanpages.com/man1/newgrp.1.php" rel="nofollow noreferrer"><code>newgrp</code></a> to start a new shell and spawn the Perl script from there, since the Perl script is executed on a remote machine over an ssh connection. The script will get a 'fresh' shell on the remote machine under my default group, not the group set via <code>newgrp</code> on the local machine.</p> <p>I cannot use the <code>sg</code> command because it only takes a single argument. I quote the full command line, including known arguments. However, the way we start remote processes over ssh includes passing local arguments along in the <code>"$@"</code> bash variable. In other words, I can do a <code>process start</code> or <code>process stop</code>, and the <code>process</code> script handles the <code>ssh</code> command and passes along any local arguments I've typed in using <code>"$@"</code>. I've tried writing a wrapper, but have discovered we use a variety of interesting local argument forms, and am hesitant to dive into the necessary quoting and escaping nightmare.</p> <p>So, my question is: is anyone aware of some other means of setting the effective group id for a running process, from Perl or bash? Is there a multi-argument form of <code>sg</code>?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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