<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: newgrp in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888280#M102410</link>
    <description>Yes it is easy to do a setuid/setgid program in C and then do a system("usr/bin/sh") but you can probably get everything to work as you want by creating an /etc/logingroup file. That will have the effect of allowing a user to be a member of multiple groups. Man logingroup for details.&lt;BR /&gt;</description>
    <pubDate>Wed, 22 Jan 2003 18:02:44 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-01-22T18:02:44Z</dc:date>
    <item>
      <title>newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888278#M102408</link>
      <description>newgrp command call a new shell, so it's impossible to use it in a shell script because all commands after the newgrp call are not executed. Is it possible to write in C the same command except calling a new shell?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Jan 2003 17:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888278#M102408</guid>
      <dc:creator>Eric Guerizec</dc:creator>
      <dc:date>2003-01-22T17:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888279#M102409</link>
      <description>Is setting the SGID bit for the shell script not an option?&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;DUncan</description>
      <pubDate>Wed, 22 Jan 2003 17:51:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888279#M102409</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2003-01-22T17:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888280#M102410</link>
      <description>Yes it is easy to do a setuid/setgid program in C and then do a system("usr/bin/sh") but you can probably get everything to work as you want by creating an /etc/logingroup file. That will have the effect of allowing a user to be a member of multiple groups. Man logingroup for details.&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Jan 2003 18:02:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888280#M102410</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-01-22T18:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888281#M102411</link>
      <description>Why I want to write a C prog? Because the max group number is 20 for a user and in my configuration I can have more than 20 groups, so /etc/logingroup is not the solution because id command reports only the 20 first groups!&lt;BR /&gt;I think you see my problem better now :)</description>
      <pubDate>Wed, 22 Jan 2003 18:19:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888281#M102411</guid>
      <dc:creator>Eric Guerizec</dc:creator>
      <dc:date>2003-01-22T18:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888282#M102412</link>
      <description>Okay, the attached C program will do the trick BUT I warn you this is a big security hole. I would install it in a directory that is only accessible by root.&lt;BR /&gt;&lt;BR /&gt;It's written in ANSI C so compile it like this:&lt;BR /&gt;&lt;BR /&gt;cc -Ae suexec.c -o suexec&lt;BR /&gt;chown root suexec&lt;BR /&gt;chmod 4755 suexec&lt;BR /&gt;&lt;BR /&gt;If you don't have a development compiler then you can convert it to K&amp;amp;R C and use the bundled compiler.&lt;BR /&gt;&lt;BR /&gt;Use it like this:&lt;BR /&gt;suexec -g mygroup tom /usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;That will start a new shell with user 'tom' group 'mygroup'.&lt;BR /&gt;&lt;BR /&gt;suexec with no args will display usage.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Jan 2003 18:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888282#M102412</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-01-22T18:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888283#M102413</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;usually the reason for using "newgrp" is to make newly created files to belong to that group.&lt;BR /&gt;&lt;BR /&gt;You can achieve that in other ways: if those file are to reside in the same directory, set the SGID bit on the directory itself (a BSD tradition) and "chgrp" that directory to the group wanted.&lt;BR /&gt;&lt;BR /&gt;FWIW,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Jan 2003 19:52:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888283#M102413</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2003-01-22T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888284#M102414</link>
      <description>Thanks A. Clay for the script. I wrote a C program like this except I verifiy if the new group is declared for the username. It will be the solution if I don't find a better one.&lt;BR /&gt;In my case, an application must be able to execute or write in other application. Each aplication had his own group.&lt;BR /&gt;If I use your C program in a script, I must execute suexec each time the script execute or write in other application.&lt;BR /&gt;Ex:&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;suexec -g newgroup user proc1&lt;BR /&gt;suexec -g newgroup user proc2&lt;BR /&gt;suexec -g newgroup user proc3&lt;BR /&gt;Now is it possible to write a C prog which change the id group for all the command in the scripts so I can call this prog only one time at the beginning of the scripts.&lt;BR /&gt;Ex:&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;suexec -g newgroup&lt;BR /&gt;proc1&lt;BR /&gt;proc2&lt;BR /&gt;proc3I am afraid that is not possible because all the C functions I know modify the gid for the current process only. So the new groupw will not valid after the suexec execution. I couldn't use newgrp because as I already said, newgrp call a new shell so in this exemple proc1, proc2 and proc3 will be never executed.</description>
      <pubDate>Thu, 23 Jan 2003 10:26:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888284#M102414</guid>
      <dc:creator>Eric Guerizec</dc:creator>
      <dc:date>2003-01-23T10:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888285#M102415</link>
      <description>Do you really need to use newgrp? Prior to 10.xx, HP-UX mandated the use of newgrp to change the user's group privileges unless the file: /etc/logingroup existed and was essentially a copy (or link) to the /etc/group file. If you run the id command, you'll see multiple group memberships listed. If not, create a link to /etc/group with:&lt;BR /&gt;&lt;BR /&gt;ln -s /etc/group /etc/logingroup&lt;BR /&gt;&lt;BR /&gt;Note that this provides membership privileges and will not change the default group like newgrp.</description>
      <pubDate>Thu, 23 Jan 2003 13:26:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888285#M102415</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-01-23T13:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: newgrp in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888286#M102416</link>
      <description>Hello Bill,&lt;BR /&gt;On HPUX, the max number of simultaneous supplementary group IDs per process (NGROUPS_MAX) is 20. In my case, I could have more than 20 groups. /etc/logingroup is only valid for 20 groups. So if you declare  one user with 21 groups, command id shows you 20 groups not 21 and you don't have any right on the last group. But you can use newgrp to acces this new group. It's why I would want a binary doing the same thing like newgrp except openning a new shell!</description>
      <pubDate>Thu, 23 Jan 2003 14:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newgrp-in-a-script/m-p/2888286#M102416</guid>
      <dc:creator>Eric Guerizec</dc:creator>
      <dc:date>2003-01-23T14:18:39Z</dc:date>
    </item>
  </channel>
</rss>

