🐧 2. Raspberry Pi – Linux Environment
Estimated reading: 4 minutes 22 views

πŸ” Raspberry Pi – User Management & Permissions (2025 Beginner Guide)


🧲 Introduction – Why User Management Matters on Raspberry Pi?

Linux-based systems like Raspberry Pi OS treat users, groups, and permissions as the backbone of system security. Whether you’re running a single Pi or managing multiple devices, understanding how to create users, assign roles, and set permissions ensures secure and smooth operation.

🎯 In this guide, you’ll learn:

  • How to create, delete, and manage users and groups
  • How Linux file and directory permissions work
  • Using sudo, chmod, chown, and groups
  • Best practices for secure and organized user management

πŸ‘€ Raspberry Pi Default User Info

By default, Raspberry Pi OS uses:

πŸ”‘ UsernameπŸ“¦ Description
piDefault user with sudo privileges
rootDisabled by default for safety

πŸ” As of newer Raspberry Pi OS releases, you are prompted to create a new user on first boot for improved security.


βž• How to Add a New User

To create a new user with a home directory:

sudo adduser <username>

πŸ” Example:

sudo adduser alex

πŸ“Œ Follow the prompts to set a password and full name (optional).


πŸ‘₯ Add User to Sudo Group

To give the new user admin rights:

sudo usermod -aG sudo <username>

Example:

sudo usermod -aG sudo alex

βœ… You can now run sudo commands as that user.


❌ Delete a User Safely

To delete a user but keep their files:

sudo deluser <username>

To delete a user and their home directory:

sudo deluser --remove-home <username>

🧼 This is useful when decommissioning users on shared Raspberry Pi setups.


πŸ‘ͺ Create and Manage Groups

Groups allow permission control over files and devices.

πŸ§ͺ CommandπŸ“˜ Description
sudo addgroup <groupname>Create a new group
sudo usermod -aG group userAdd a user to a group
groups <username>List user’s group memberships

πŸ” Example:

sudo addgroup developers
sudo usermod -aG developers alex

πŸ” Understanding File Permissions

Each file and folder has three levels of permissions: Owner, Group, Others

ls -l

Example output:

-rw-r--r-- 1 pi pi  1024 Jan 1 10:00 notes.txt
PartMeaning
-rw-r--r--Permissions: read/write owner, read-only for group/others
1Number of hard links
piOwner name
piGroup name

✏️ Change File Permissions with chmod

πŸ§ͺ CommandπŸ“˜ Use Case
chmod +x <file>Make script executable
chmod 644 <file>Owner read/write, others read
chmod 755 <file>Executable by all, writable by owner

Example:

chmod 700 secret.sh

πŸ”„ Change Ownership with chown

To change file owner:

sudo chown alex:alex notes.txt

To give ownership recursively:

sudo chown -R alex:alex /home/alex

βœ… Useful when transferring project files between users.


πŸ“œ Sudo: Run as Root Privileges

The sudo command allows users in the sudo group to execute commands with administrative privileges:

sudo apt update

To switch to root shell (temporarily):

sudo -i

πŸ“¦ System-Wide User Info Files

πŸ“ FileπŸ“˜ Description
/etc/passwdContains user account info
/etc/shadowStores encrypted passwords
/etc/groupGroup definitions and user associations
/etc/sudoersDefines who can run what with sudo

⚠️ Always use visudo to safely edit /etc/sudoers.


🧠 Best Practices for User Management

  • πŸ”’ Avoid logging in as root β€” use sudo instead
  • πŸ§‘β€πŸ€β€πŸ§‘ Create a unique user for each person using the Pi
  • πŸ” Use strong passwords or SSH key authentication
  • πŸ” Review group permissions regularly for security
  • πŸ“ Limit writable directories for non-admin users

πŸ“Œ Summary – Recap & Next Steps

User and permission management in Linux is key to keeping your Raspberry Pi secure and organizedβ€”especially when multiple users or sensitive files are involved.

πŸ” Key takeaways:

  • Use adduser, deluser, and usermod to manage users and roles
  • File permissions define access for owner, group, and others
  • chmod, chown, and groups are vital tools for permission control
  • Always manage sudo rights cautiously

βš™οΈ Real-world relevance: Perfect for projects requiring team access, IoT device security, or hosting public-facing services on your Raspberry Pi.


❓ FAQs – Raspberry Pi User Management

❓ How do I enable root user on Raspberry Pi?

βœ… You can set a root password:

sudo passwd root

Then log in with su -. Not recommended for daily use.


❓ How can I give a user sudo access?

βœ… Add them to the sudo group:

sudo usermod -aG sudo username

❓ How do I view all users on Raspberry Pi?

βœ… Use:

cut -d: -f1 /etc/passwd

❓ How can I list all groups a user belongs to?

βœ… Use:

groups <username>

❓ What’s the safest way to edit sudo privileges?

βœ… Use:

sudo visudo

This checks syntax before saving to prevent system lockout.


Share Now :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

πŸ” Raspberry Pi – User Management & Permissions

Or Copy Link

CONTENTS
Scroll to Top