<?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: Unix logon menu script question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541812#M223373</link>
    <description>Jim, &lt;BR /&gt;&lt;BR /&gt;Are you looking to create a menu that the user sees up login? When they login and select their menu option, do you plan to have them exit the menu to a shell or will the menu "su" to their account?&lt;BR /&gt;&lt;BR /&gt;One problem here is what to do if the script terminates before the user's original groups are restored. Maybe if you provide a bit more detail on who/what/why... someone might be able to throw something better together.&lt;BR /&gt;&lt;BR /&gt;Anyhow, sounds to me like you'd want the script to collect the user's info then loop the menu and run your commands. upon exiting the loop, set the users group back to the orginal settings.&lt;BR /&gt;&lt;BR /&gt;example&lt;BR /&gt;----&lt;BR /&gt;&lt;BR /&gt;USER=`logname`&lt;BR /&gt;OLD_GROUPS=`groups`&lt;BR /&gt;&lt;BR /&gt;rval=0&lt;BR /&gt;until [ $rval -eq 1 ];do&lt;BR /&gt;&lt;BR /&gt;cat &amp;lt;&amp;lt; EOF&lt;BR /&gt;   your menu stuff...&lt;BR /&gt;   OPT1    this is option 1&lt;BR /&gt;   OPT2    this is option 1&lt;BR /&gt;   EXIT    &lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;case $SELECT in&lt;BR /&gt;   OPT1) your add grp cmds&lt;BR /&gt;         and other user commands, etc&lt;BR /&gt;   ;;&lt;BR /&gt;   OPT2) your add grp cmds&lt;BR /&gt;         and other user commands, etc&lt;BR /&gt;   ;;&lt;BR /&gt;   EXIT) rval=1 &lt;BR /&gt;   ;;&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;your commands to set groups to $OLD_GROUPS&lt;BR /&gt;and whatever else you need to do...&lt;BR /&gt;&lt;BR /&gt;----&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps,&lt;BR /&gt;-denver</description>
    <pubDate>Wed, 11 May 2005 07:41:58 GMT</pubDate>
    <dc:creator>Denver Osborn</dc:creator>
    <dc:date>2005-05-11T07:41:58Z</dc:date>
    <item>
      <title>Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541803#M223364</link>
      <description>1)  Thanks to all the replied that help me with the last question.&lt;BR /&gt;I need to be able to modify the /etc/group file from a shell script. I can add user xxxusr01 to the supplemental group mc_xxx01 using the command &lt;BR /&gt;&lt;BR /&gt;        usermod -G mc_xxx01 xxxusr01 &lt;BR /&gt;&lt;BR /&gt;but I cannot find a command to use in a shell script to remove a user from a group. &lt;BR /&gt;&lt;BR /&gt;we do not want to edit the etc/group file directly. &lt;BR /&gt;</description>
      <pubDate>Tue, 10 May 2005 22:38:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541803#M223364</guid>
      <dc:creator>Jim Tropiano_1</dc:creator>
      <dc:date>2005-05-10T22:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541804#M223365</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;do u want to remove user from primary or secondary group?&lt;BR /&gt;&lt;BR /&gt;regards.</description>
      <pubDate>Tue, 10 May 2005 22:50:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541804#M223365</guid>
      <dc:creator>Joseph Loo</dc:creator>
      <dc:date>2005-05-10T22:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541805#M223366</link>
      <description>I am thinking it would be the secondary group.</description>
      <pubDate>Tue, 10 May 2005 22:54:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541805#M223366</guid>
      <dc:creator>Jim Tropiano_1</dc:creator>
      <dc:date>2005-05-10T22:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541806#M223367</link>
      <description>The only way to add or remove a user from a group is by usermod only.&lt;BR /&gt;First do groups on that user&lt;BR /&gt;groups usr1 (to list the groups it belong to)&lt;BR /&gt;then&lt;BR /&gt;usermod -G grp1,grp2,grp3,grp4 usr1&lt;BR /&gt;will add the user to grp1, grp2,grp3 and grp4 group.&lt;BR /&gt;Now say you want to remove him from grp4 then do&lt;BR /&gt;usermod -G grp1,grp2,grp3 usr1&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Rajeev</description>
      <pubDate>Tue, 10 May 2005 23:02:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541806#M223367</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2005-05-10T23:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541807#M223368</link>
      <description>seems to be very good idea&lt;BR /&gt;&lt;BR /&gt;-Niraj</description>
      <pubDate>Tue, 10 May 2005 23:05:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541807#M223368</guid>
      <dc:creator>Niraj Kumar Verma</dc:creator>
      <dc:date>2005-05-10T23:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541808#M223369</link>
      <description>I don't think usermod can selectively remove a user from a single group. It can only redefine group membership.&lt;BR /&gt;&lt;BR /&gt;You can try using SAM's backend command grpusrs.&lt;BR /&gt;&lt;BR /&gt;# /usr/sam/lbin/grpusrs -d -l &lt;LOGIN&gt; &lt;GROUP&gt;&lt;BR /&gt;&lt;BR /&gt;This would delete &lt;LOGIN&gt; from &lt;GROUP&gt; not affecting other members of &lt;GROUP&gt;.&lt;/GROUP&gt;&lt;/GROUP&gt;&lt;/LOGIN&gt;&lt;/GROUP&gt;&lt;/LOGIN&gt;</description>
      <pubDate>Tue, 10 May 2005 23:06:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541808#M223369</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-05-10T23:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541809#M223370</link>
      <description>We will be runnig this from a menu. &lt;BR /&gt;&lt;BR /&gt;The user will logon and the menu selection will allow them to selected what they have access to. &lt;BR /&gt;Example &lt;BR /&gt;select enviroment&lt;BR /&gt;&lt;BR /&gt;1  - TEST&lt;BR /&gt;2  - Prod support&lt;BR /&gt;3  - DEV&lt;BR /&gt;4  - DEV01&lt;BR /&gt;5  EXIT&lt;BR /&gt;&lt;BR /&gt;If they select one the they get put into group TEST.  When they are done with TEST they get back to the menu and can select another environment.  Let say 3&lt;BR /&gt;Now we want to delete them from group TEST and add them to group DEV</description>
      <pubDate>Tue, 10 May 2005 23:14:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541809#M223370</guid>
      <dc:creator>Jim Tropiano_1</dc:creator>
      <dc:date>2005-05-10T23:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541810#M223371</link>
      <description>This would mean that any selection would lead the user to a different secondary group.&lt;BR /&gt;&lt;BR /&gt;You can use 'case' here, something like:&lt;BR /&gt;&lt;BR /&gt;case "$selection" in&lt;BR /&gt;   TEST ) usermod -G test user;;&lt;BR /&gt;   Prod support ) usermod -G prod user;;&lt;BR /&gt;   DEV ) usermod -G dev user;;&lt;BR /&gt;   DEV01 ) usermod -G dev01 user;;&lt;BR /&gt;    ...&lt;BR /&gt;    ...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Suraj&lt;BR /&gt;   &lt;BR /&gt;</description>
      <pubDate>Tue, 10 May 2005 23:59:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541810#M223371</guid>
      <dc:creator>Suraj Singh_1</dc:creator>
      <dc:date>2005-05-10T23:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541811#M223372</link>
      <description>We would use the case statement on their selection but when they return to the menu we would like to delete that group they were just in. Also if they select a group we would like to add that grop as a secondary group.   then we would enviromental variables to the group they are in.</description>
      <pubDate>Wed, 11 May 2005 06:45:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541811#M223372</guid>
      <dc:creator>Jim Tropiano_1</dc:creator>
      <dc:date>2005-05-11T06:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541812#M223373</link>
      <description>Jim, &lt;BR /&gt;&lt;BR /&gt;Are you looking to create a menu that the user sees up login? When they login and select their menu option, do you plan to have them exit the menu to a shell or will the menu "su" to their account?&lt;BR /&gt;&lt;BR /&gt;One problem here is what to do if the script terminates before the user's original groups are restored. Maybe if you provide a bit more detail on who/what/why... someone might be able to throw something better together.&lt;BR /&gt;&lt;BR /&gt;Anyhow, sounds to me like you'd want the script to collect the user's info then loop the menu and run your commands. upon exiting the loop, set the users group back to the orginal settings.&lt;BR /&gt;&lt;BR /&gt;example&lt;BR /&gt;----&lt;BR /&gt;&lt;BR /&gt;USER=`logname`&lt;BR /&gt;OLD_GROUPS=`groups`&lt;BR /&gt;&lt;BR /&gt;rval=0&lt;BR /&gt;until [ $rval -eq 1 ];do&lt;BR /&gt;&lt;BR /&gt;cat &amp;lt;&amp;lt; EOF&lt;BR /&gt;   your menu stuff...&lt;BR /&gt;   OPT1    this is option 1&lt;BR /&gt;   OPT2    this is option 1&lt;BR /&gt;   EXIT    &lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;case $SELECT in&lt;BR /&gt;   OPT1) your add grp cmds&lt;BR /&gt;         and other user commands, etc&lt;BR /&gt;   ;;&lt;BR /&gt;   OPT2) your add grp cmds&lt;BR /&gt;         and other user commands, etc&lt;BR /&gt;   ;;&lt;BR /&gt;   EXIT) rval=1 &lt;BR /&gt;   ;;&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;your commands to set groups to $OLD_GROUPS&lt;BR /&gt;and whatever else you need to do...&lt;BR /&gt;&lt;BR /&gt;----&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps,&lt;BR /&gt;-denver</description>
      <pubDate>Wed, 11 May 2005 07:41:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541812#M223373</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2005-05-11T07:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unix logon menu script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541813#M223374</link>
      <description>doh!  I know, I  know... forgot "esac" before "done"&lt;BR /&gt;&lt;BR /&gt;you know what I meant  :)</description>
      <pubDate>Wed, 11 May 2005 07:44:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-logon-menu-script-question/m-p/3541813#M223374</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2005-05-11T07:44:51Z</dc:date>
    </item>
  </channel>
</rss>

