User Group Commands

Posted by admin | Linux Commands | Saturday 5 July 2008 6:45 pm

PAGE TAGS: linux group command, linux groups command, linux user group command, linux change group command, linux add group command, group command linux, linux group, linux add group, linux add user

LINUX GROUP COMMANDS AND FILES

groupadd name = Create a group.Example: groupadd sales creates the sales group

groupmod -n newname name = Change the name of a group. Example: groupmod -n sales2 sales renames the sales group to sales2

groupdel name = groupdel name Example: groupdel mktg deletes the mktg group

gpasswd name = Change a group password (use the -r option to remove a group password). Example: Typing gpasswd sales prompts you to type the group password

newgrp name = Log in to a new group. You must have the group password to complete this command. Example: Typing newgrp sales prompts you for the password for the sales group so you can log in

usermod -g group user = Assign a user to a primary group. Example: useradd -g pmaxwell pmaxwell assigns primary group membership for user pmaxwell to the pmaxwell group

usermod -G group1,group2 user = Assign a user to a secondary group (or groups). Follow the command with a comma-separated list of groups. Example: usermod -G sales,mktg pmorril removes all existing group assignments for pmorril and makes the user account a member of the sales and mktg groups. (You can remove a user from all secondary groups by using the command usermod -G “” user.)