Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Managing User Accounts with dscl on macOS

In the Apple environment, the dscl command-line utility is a powerful tool for managing user accounts. It allows system administrators to create, modify, and delete user accounts directly from the command line, providing a convenient and efficient way to perform user management tasks.

One of the key advantages of using dscl is its flexibility and scripting capabilities. With the ability to write scripts using dscl commands, system administrators can automate user management tasks, saving time and effort.

Examples:

  1. Creating a User Account: To create a new user account using dscl, open the Terminal application and run the following command:

    sudo dscl . -create /Users/johndoe
    sudo dscl . -create /Users/johndoe UserShell /bin/bash
    sudo dscl . -create /Users/johndoe RealName "John Doe"
    sudo dscl . -create /Users/johndoe UniqueID 1001
    sudo dscl . -create /Users/johndoe PrimaryGroupID 1000
    sudo dscl . -create /Users/johndoe NFSHomeDirectory /Users/johndoe
    sudo dscl . -passwd /Users/johndoe

    This example creates a new user account named "johndoe" with a unique ID of 1001 and a primary group ID of 1000. The user's home directory is set to "/Users/johndoe", and the user's password is set using the "passwd" command.

  2. Modifying a User Account: To modify an existing user account using dscl, run the following command:

    sudo dscl . -create /Users/johndoe Picture "/Path/To/Picture.jpg"

    This example sets the user's profile picture to the specified image file.

  3. Deleting a User Account: To delete a user account using dscl, run the following command:

    sudo dscl . -delete /Users/johndoe

    This example deletes the user account named "johndoe" from the system.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.