User access and management

This section covers how to manage users and passwords on your Raspberry Pi, including how to:

Quick reference

This is a short list of some of the commands referenced by the procedures in this section.

Function Command

List all existing users.

$ ls -l /home

Check the group permissions for the current user.

$ groups

Add a new user.

$ sudo adduser

Switch to a different user.

$ sudo su - <username>

Delete a user and their home directory.

$ sudo deluser --remove-home <username>

Change the current user’s password.

$ passwd

Open the configuration centre.

$ sudo raspi-config

View existing users

To get a list of existing users and their home directories on your Raspberry Pi device, run the following command:

$ ls -l /home

You can navigate to the home directory of a user listed here using the following command, replacing <username> with the username of the user:

$ cd /home/<username>
$ ls -la

Add a user

To add a new user to your Raspberry Pi:

  1. Enter the following command, replacing <username> with the username for the new user:

    $ sudo adduser <username>
  2. When prompted, enter a password for the new user.

  3. Optionally, add additional information about the new user, such as their full name, room number, and so on. If you don’t want to include this information, press Enter or Return on your keyboard to skip.

  4. Press Y followed by Enter or Return to indicate that the information is correct.

Verify a user exists

When you create a new user, their home directory is automatically created at /home/<username>. To check the home directory for the new user, run the following command: /home/<username>/, replacing <username> with the user’s username. This returns something like:

-bash: /home/<username>: Is a directory

Grant user access permissions

You can grant a user specific permissions by adding them to system groups.

Run the following command, replacing <username> with the new user’s username. Including the sudo group in the following command gives the user superuser privileges.

$ sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,render,netdev,lpadmin,gpio,i2c,spi <username>

To check that the changes were applied successfully, switch to the user account and then check their permissions, described below.

Switch user

To switch to a different user, run the following command, replacing <username> with the username of the user:

$ sudo su - <username>

Check permissions

To check the groups a user belongs to, switch to the user account then run the following command:

$ groups

Delete a user

To delete a user from your Raspberry Pi, enter the following command, replacing <username> with the username for the user. This deletes both the user and their home directory. To preserve the user’s home directory, run the command without the --remove-home option.

$ sudo deluser --remove-home <username>

Press Y followed by Enter or Return on your keyboard to indicate that the information is correct.

Change your password

You can change password for the current user from the desktop, the TUI, or the command line.

Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.

  2. Open the System tab in the left-side menu.

  3. Select Change Password.

  4. In the Enter new password field, enter a new password.

  5. In the Confirm new password field, enter the same password again.

  6. Select Close in the bottom-right corner of the Control Centre.

  7. Reboot your Raspberry Pi to apply your new password.

raspi-config
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 1 System Options > S3 Password.

  3. Select <OK> to confirm that you want to change the password for the current, named user.

  4. Enter a password and then press the Enter or Return key on your keyboard. The Terminal doesn’t show your characters as you type them.

  5. Enter the same password a second time and then press the Enter or Return key on your keyboard. If this is done correctly, a success message appears telling you that the password was updated successfully.

  6. Select <OK> and then <Finish> when you’re done.

  7. Reboot your Raspberry Pi to apply your new password.

CLI

For a fully command-line experience of changing your password, you can manually set your password using the passwd CLI application:

  1. Open the Terminal and run passwd.

  2. Enter your current password and then press the Enter or Return key on your keyboard. The Terminal doesn’t show your characters as you type them.

  3. Enter a password and then press the Enter or Return key on your keyboard.

  4. Enter the same password a second time and then press the Enter or Return key on your keyboard. If this is done correctly, a success message appears telling you that the password was updated successfully.

  5. Reboot your Raspberry Pi to apply your new password.

Require a password from startup

You can require users to enter their password when booting the Raspberry Pi by turning off Auto Login.

When you turn off auto login, you choose whether to separately require the password for signing in to the console and the desktop.

By default, Raspberry Pi OS with desktop signs in to the desktop automatically when it starts up. Raspberry Pi OS Lite doesn’t sign in automatically.

While auto login is turned on, anyone with physical access to your Raspberry Pi can use your user account without a password. That includes your files, any passwords saved in your browser, and any accounts you’re signed in to. If the password for superuser commands is also turned off, they have full control of your Raspberry Pi.

If other people might have access to your Raspberry Pi, for example in a shared office, a classroom, or a public place, turn off auto login.

Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.

  2. Open the System tab in the left-side menu.

  3. To configure your Raspberry Pi to require a password when you boot into the console, turn off Console Auto Login using the respective toggle.

  4. To configure your Raspberry Pi to require a password when you boot into the desktop, turn off Desktop Auto Login using the respective toggle.

  5. Select Close in the bottom-right corner of the Control Centre.

  6. Reboot your Raspberry Pi to apply your changes.

raspi-config
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 1 System Options > S6 Auto Login.

  3. Select Yes or No in response to the question Would you like to automatically log in to the console? Selecting No configures your Raspberry Pi to require a password when you boot into the Raspberry Pi command line (CLI).

  4. Select <OK> to confirm this choice.

  5. Select Yes or No in response to the question Would you like to automatically log in to the desktop? Selecting No configures your Raspberry Pi to require a password when you boot into the Raspberry Pi desktop.

  6. Select <OK> to confirm this choice.

  7. Select <Finish> when you’re done.

  8. Reboot your Raspberry Pi to apply your changes.

Turn off password for superuser commands

In Raspberry Pi OS, prefixing a command with sudo runs that command with superuser (admin) privileges. By default, Raspberry Pi OS requires you to enter your password when running sudo commands. This prevents unauthorised users and software from running sudo commands on your device. After you enter your password correctly, Raspberry Pi OS doesn’t ask for it again for five minutes.

You can override this setting after installation through either the desktop or by using the interactive raspi-config TUI.

Without a password for superuser commands, any person or program that can run commands as your user can take full control of your Raspberry Pi. This includes malicious software, and anyone who uses a session you’ve left signed in. If auto login is also turned on, anyone with physical access to your Raspberry Pi has full control of it.

We strongly recommend that you keep the password requirement turned on.

Installations of Raspberry Pi OS from before version 6.2 (April 2026) don’t require a password for sudo commands, and updating doesn’t change this. To require a password, follow these steps and turn on Admin Password.
Desktop
  1. Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.

  2. Open the System tab in the left-side menu.

  3. Use the toggle next to Admin Password to turn off the password requirement for sudo commands.

  4. Select Close in the bottom-right corner of the Control Centre.

  5. Reboot your Raspberry Pi to apply your changes.

raspi-config
  1. Open the Terminal and run sudo raspi-config.

  2. Use the keyboard to navigate to and select 1 System Options > S10 Admin Password.

  3. Select Yes or No in response to the question Would you like the admin (sudo) password to be enabled? Selecting No turns off the password requirement for sudo commands.

  4. Select <OK> to confirm this choice.

  5. Select <Finish> when you’re done.

  6. Reboot your Raspberry Pi to apply your changes.