- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unix logon menu script question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 03:38 PM
тАО05-10-2005 03:38 PM
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
usermod -G mc_xxx01 xxxusr01
but I cannot find a command to use in a shell script to remove a user from a group.
we do not want to edit the etc/group file directly.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 03:50 PM
тАО05-10-2005 03:50 PM
Re: Unix logon menu script question
do u want to remove user from primary or secondary group?
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 03:54 PM
тАО05-10-2005 03:54 PM
Re: Unix logon menu script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 04:02 PM
тАО05-10-2005 04:02 PM
Re: Unix logon menu script question
First do groups on that user
groups usr1 (to list the groups it belong to)
then
usermod -G grp1,grp2,grp3,grp4 usr1
will add the user to grp1, grp2,grp3 and grp4 group.
Now say you want to remove him from grp4 then do
usermod -G grp1,grp2,grp3 usr1
Cheers
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 04:05 PM
тАО05-10-2005 04:05 PM
Re: Unix logon menu script question
-Niraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 04:06 PM
тАО05-10-2005 04:06 PM
SolutionYou can try using SAM's backend command grpusrs.
# /usr/sam/lbin/grpusrs -d -l
This would delete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 04:14 PM
тАО05-10-2005 04:14 PM
Re: Unix logon menu script question
The user will logon and the menu selection will allow them to selected what they have access to.
Example
select enviroment
1 - TEST
2 - Prod support
3 - DEV
4 - DEV01
5 EXIT
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
Now we want to delete them from group TEST and add them to group DEV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 04:59 PM
тАО05-10-2005 04:59 PM
Re: Unix logon menu script question
You can use 'case' here, something like:
case "$selection" in
TEST ) usermod -G test user;;
Prod support ) usermod -G prod user;;
DEV ) usermod -G dev user;;
DEV01 ) usermod -G dev01 user;;
...
...
Regards,
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 11:45 PM
тАО05-10-2005 11:45 PM
Re: Unix logon menu script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2005 12:41 AM
тАО05-11-2005 12:41 AM
Re: Unix logon menu script question
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?
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.
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.
example
----
USER=`logname`
OLD_GROUPS=`groups`
rval=0
until [ $rval -eq 1 ];do
cat << EOF
your menu stuff...
OPT1 this is option 1
OPT2 this is option 1
EXIT
EOF
case $SELECT in
OPT1) your add grp cmds
and other user commands, etc
;;
OPT2) your add grp cmds
and other user commands, etc
;;
EXIT) rval=1
;;
done
your commands to set groups to $OLD_GROUPS
and whatever else you need to do...
----
hope this helps,
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2005 12:44 AM
тАО05-11-2005 12:44 AM
Re: Unix logon menu script question
you know what I meant :)