Howto: Linux creating user account under group
Q. How do I add a new user called foo under existing group bar?
A. You need to use useradd command, which create a new user or update default new user information. You need to pass -g option to useradd command. It specifies the group name or number of the user’s initial login group. The group name must exist. A group number must refer to an already existing group. The default group number is 1 or whatever is specified in /etc/default/useradd file.
Task: Make sure group sales exists
# grep 'sales' /etc/group
Task: Add a new user tom to group sales
# useradd -g sales tom
# passwd tom
You can add existing user jerry to group sales with usermod command:
# usermod -g sales jerry
You can add existing user jerry to secondary group purchase with usermod command:
# usermod -G purchase jerry
Please note that above commands works with Solaris UNIX, FreeBSD and UNIX like oses.
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:
- Linux add a user using command line tools
- FreeBSD locking an account
- How to add a ssh user in FreeBSD server
- Linux setup shared directory
- Linux locking an account
Discussion on This FAQ
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!


March 31st, 2008 at 8:47 am
Hi,
How can i add an user who has root permissions.
Regards
Eagle