FreeBSD add a user to group
by Vivek Gite
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 groupmod ftpusers -m TEST_NAME
Note: this way user TEST_NAME will be added to group operator without replacing or overwriting anything.
If you want to add the user TEST_NAME to ftpusers group only, and remove the user from other groups:
# pw usermod TEST_NAME -G ftpusers
or specifing multple groups, add TEST_NAME to secondary group ftpusers 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.
Reference:
http://www.cyberciti.biz/faq/freebsd-add-a-user-to-group/
Wednesday, August 3, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment