groupadd / groupmod / newgrp / groups
The file that stores group information is:
/etc/group
bash-3.00# cat /etc/group
root::0:
other::1:root
bin::2:root,daemon
sys::3:root,bin,adm
adm::4:root,daemon
uucp::5:root
mail::6:root
tty::7:root,adm
lp::8:root,adm
nuucp::9:root
staff::10:
daemon::12:root
sysadmin::14:
smmsp::25:
gdm::50:
webservd::80:
postgres::90:
nobody::60001:
noaccess::60002:
nogroup::65534:
mysql::100:
sasl::101:
columns:
group_name : optional_password : GID : list_ofmembers (comma-delimeted)
Groups are basically use to restric or permit access to resources.
-bash-3.00# groups
root other bin sys adm uucp mail tty lp nuucp daemon
-bash-3.00# groups paco
other
To create groups ‘groupadd’
max 8 caracteres.
-bash-3.00# groupadd learn
-bash-3.00# groupadd -g 10000 learn2
Rules regarding groups:
A user can belong to 1 primary group and up to 15 secondary groups
Primary groups: permit the operating system to assing a default group to object (files/directories)
Secondary groups: permit subjects (users) the flexibility to access various group-protected resources.
To show primary group:
-bash-3.00# id
uid=0(root) gid=0(root)
-bash-3.00# id paco
uid=100(paco) gid=1(other)
How to assign existing user(s) to a newly-create group?
usermod -G group1,group2,group3
usermod -G learngroup paco
#### How to create new user and assing the user to the ‘training’ secondary group? ###
useradd -G training -s /usr/bin/bash pedro
### How to change default/primary group temporarily ? ####
groups
newgrp group_name
with no options will return to the primary default group
newgrp
next Solaris MGMT. Console ….