FreeBSD add a user to group
Q. How do I add a user to group under FreeBSD operating system?
A. You need to use pw command. The pw utility is a command-line based editor for the system user and group files, allowing the superuser an easy to use and standardized way of adding, modifying and removing users and groups. First login as the root using su or sudo command.
Task: Add existing user to group
You would like to add existing user tom to secondary group called ftpusers. Type the command as follows:
# pw usermod tom -G ftpusers
You can add tom to secondary group ftpuser and wwwusers:
# pw usermod tom -G ftpusers,wwwusers
-G option Set the default groups in which new users are granted membership. This is a separate set of groups from the primary group, and you should avoid nominating the same group as both primary and extra groups.
Task: Add a new user to group
Add new user jerry to system and to secondary group sales:
# pw useradd jerry -G sales
# passwd jerry
First command adds user jerry to secondary group called sales. Second commands set a password for jerry.
Further readings:
=>Read pw command man page.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Howto: Linux creating user account under group
- Linux setup shared directory
- FreeBSD locking an account
- Howto: Linux Add User To Group
- FreeBSD pw command examples
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: group_files, pw_command, secondary_group



Recent Comments
Today ~ 1 Comment
Today ~ 2 Comments
Yesterday ~ 9 Comments
Yesterday ~ 32 Comments
07/04/2008 07:04 pm (2 days ago) ~ 1 Comment