How to add a user to a group in Mac

Source: Internet
Author: User
Cause:

When using MacLinuxOperations on users and groups are the same, but gpasswd and usermod used in Linux are not available on Mac, and dscl is used on Mac to operate on group and user.

Introduction:

 
$ Man dscldscl (1) BSD General commands manual dscl (1) Name dscl -- directory service command line utilitydescription dscl is a general-purpose Utility for operating on directory service directory nodes. its commands allow one to create, read, and manage directory service data.

Method: visualization method:

System Preferences-> Users & groups and perform manual operations. However, not all users can be viewed here, for example, _ www.

Display the group corresponding to all users:
 
$ Sudo dscl.-list/groups groupmembership
Add User to group:
$ Sudo dscl.-append/groups/groupname groupmembership Username
Delete a user from a group:
 
$ Sudo dscl.-delete/groups/groupname groupmembership Username

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.