User access and management
This section covers how to manage users and passwords on your Raspberry Pi, including how to:
-
View existing users from the command line to see which users exist on your Raspberry Pi device.
-
Add a user from the command line to create a new user with a separate account and home directory on your Raspberry Pi.
-
Verify a user exists from the command line to check that a new user exists and has a home directory.
-
Grant user access permissions from the command line to give user accounts on your Raspberry Pi access to groups and superuser permissions.
-
Switch user from the command line to change the active user on your Raspberry Pi.
-
Check permissions from the command line to check the groups a user belongs to.
-
Delete a user from your Raspberry Pi from the command line.
-
Change your password from the desktop, in the TUI, or from the command line.
-
Require a password from startup by turning off auto login from the desktop or in the TUI.
-
Turn off password for superuser commands from the desktop or in the TUI.
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. |
|
Check the group permissions for the current user. |
|
Add a new user. |
|
Switch to a different user. |
|
Delete a user and their home directory. |
|
Change the current user’s password. |
|
Open the configuration centre. |
|
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:
-
Enter the following command, replacing <username> with the username for the new user:
$ sudo adduser <username> -
When prompted, enter a password for the new user.
-
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.
-
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
-
-
Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.
-
Open the System tab in the left-side menu.
-
Select Change Password.
-
In the Enter new password field, enter a new password.
-
In the Confirm new password field, enter the same password again.
-
Select Close in the bottom-right corner of the Control Centre.
-
Reboot your Raspberry Pi to apply your new password.
-
- raspi-config
-
-
Open the Terminal and run
sudo raspi-config. -
Use the keyboard to navigate to and select
1 System Options > S3 Password. -
Select
<OK>to confirm that you want to change the password for the current, named user. -
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.
-
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.
-
Select
<OK>and then<Finish>when you’re done. -
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
passwdCLI application:-
Open the Terminal and run
passwd. -
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.
-
Enter a password and then press the Enter or Return key on your keyboard.
-
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.
-
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
-
-
Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.
-
Open the System tab in the left-side menu.
-
To configure your Raspberry Pi to require a password when you boot into the console, turn off Console Auto Login using the respective toggle.
-
To configure your Raspberry Pi to require a password when you boot into the desktop, turn off Desktop Auto Login using the respective toggle.
-
Select Close in the bottom-right corner of the Control Centre.
-
Reboot your Raspberry Pi to apply your changes.
-
- raspi-config
-
-
Open the Terminal and run
sudo raspi-config. -
Use the keyboard to navigate to and select
1 System Options > S6 Auto Login. -
Select
YesorNoin response to the question Would you like to automatically log in to the console? SelectingNoconfigures your Raspberry Pi to require a password when you boot into the Raspberry Pi command line (CLI). -
Select
<OK>to confirm this choice. -
Select
YesorNoin response to the question Would you like to automatically log in to the desktop? SelectingNoconfigures your Raspberry Pi to require a password when you boot into the Raspberry Pi desktop. -
Select
<OK>to confirm this choice. -
Select
<Finish>when you’re done. -
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
-
-
Select the Raspberry Pi icon in the top-left corner of the system tray and then go to Preferences > Control Centre.
-
Open the System tab in the left-side menu.
-
Use the toggle next to Admin Password to turn off the password requirement for
sudocommands. -
Select Close in the bottom-right corner of the Control Centre.
-
Reboot your Raspberry Pi to apply your changes.
-
- raspi-config
-
-
Open the Terminal and run
sudo raspi-config. -
Use the keyboard to navigate to and select
1 System Options > S10 Admin Password. -
Select
YesorNoin response to the question Would you like the admin (sudo) password to be enabled? SelectingNoturns off the password requirement forsudocommands. -
Select
<OK>to confirm this choice. -
Select
<Finish>when you’re done. -
Reboot your Raspberry Pi to apply your changes.
-