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

How to Manage Users on Raspberry Pi: A Comprehensive Guide

Managing users on a Raspberry Pi is an essential task for maintaining security and ensuring proper access control. Whether you're setting up a Raspberry Pi for personal use, as a server, or for a project, understanding user management is crucial. This guide will walk you through the process of creating, modifying, and deleting users, as well as managing their permissions using the command line.

Examples:

  1. Creating a New User:

    To create a new user on your Raspberry Pi, you can use the adduser command. This command not only creates a user but also sets up a home directory and prompts you to set a password.

    sudo adduser newusername

    Follow the prompts to set the password and fill in any additional information if necessary.

  2. Modifying User Permissions:

    To modify user permissions, you can add the user to specific groups. For example, to grant a user sudo privileges, you can add them to the sudo group:

    sudo usermod -aG sudo newusername

    This command appends the user to the sudo group, allowing them to execute commands as the superuser.

  3. Deleting a User:

    If you need to remove a user and their home directory, use the deluser command with the --remove-home option:

    sudo deluser --remove-home newusername

    This command deletes the user and their home directory, freeing up space and ensuring that no residual files are left behind.

  4. Listing All Users:

    To view all users on your Raspberry Pi, you can check the /etc/passwd file:

    cat /etc/passwd

    This file contains all user account information. Each line represents a user, with fields separated by colons.

  5. Changing a User's Password:

    To change a user's password, use the passwd command:

    sudo passwd newusername

    You'll be prompted to enter a new password for the user.

  6. Switching Between Users:

    To switch between users, use the su command followed by the username:

    su - newusername

    This command switches the current session to the specified user.

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.