Hi,
Thanks. I usually edit '/etc/group' but the extra info is v. useful.
Gavin.
On Mon, 2005-12-05 at 08:20 -0600, Brett Johnson wrote:
> There are a couple ways of modifying groups;
>
> First you can use "vigr", this will load /etc/groups in your default
> editor and allow you to change the file. Upon exiting, it will check
> your changes for proper formatting and let you know if the file is
> not formatted properly. This is the method I use.
>
> To add yourself to vmware group, find the line:
> vmware:x:449:
> and add the login name of the users after the last colon, using a
> comma to separate multiple names:
> vmware:x:449:user1,user2
>
> A second method is "usermod". This requires a bit more work, since you
> have to specify all the groups you want access to with the -G option. If
> you omit a group that you were previously a member of, you will be removed
> from that group. So you would type something like:
> usermod -G wheel,audio,video,
>
> A simple wrapper shell script like this could be used to add additional
> groups without having to retype all groups:
>
> #!/bin/bash
> #
> # Script to add a user to a group using the usermod tool.
> #
> # TODO: Verify awk and usermod exist and can execute.
> ME="`/usr/bin/basename ${0}`"
> AWK="/bin/awk"
> USERMOD="/usr/sbin/usermod"
>
> # Check to make sure we have 2 arguments.
> if [ $# -ne 2 ]; then
> echo "Usage: ${ME} group[,group ...] user"
> exit -99
> fi
>
> # TODO: Additional checking of args, make sure user and groups exist, but
> # for now the usermod tool will throw an error if they do not exist.
>
> # Get list of groups user belongs to.
> GRPS=`${AWK} -F: '/(:|,)'${2}'(,|$)/{grps=$1 "," grps} END{print grps}'
> /etc/group`
>
> # TODO: Check to see if user is already in group(s) specified.
>
> # Call usermod tool.
> ${USERMOD} -G ${GRPS}${1} ${2}
>
> Brett
>
>
> theboywho wrote:
>
> >On Monday 05 December 2005 11:10, Gavin Seddon wrote:
> >
> >
> >>Hithanks for all the responses.
> >>If I chgrp to vmware will I be able to use su?
> >>
> >>
> >
> >I think to be able to 'su' you need to be in the wheel group as well. I
> >added
> >myself to the vmware group by editing the /etc/group file and adding my user
> >name to the line for vmware. I'm not sure if this the 'Right Way' to do it,
> >but it worked for me.
> >
> >
> >
--
Dr Gavin Seddon
School of Pharmacy and Pharmaceutical Sciences
University of Manchester
Oxford Road, Manchester
M13 9PL, U.K.
--
[email protected] mailing list