Creating multiple users on a Raspberry Pi system is beneficial since it allows users the freedom to use the system according to their needs. They can do any task they want without affecting other users’ settings. If you are interested in creating multiple users on your Raspberry Pi system, follow this article for detailed guidance.
How to Create Multiple User Accounts on Raspberry Pi?
The Raspberry Pi has a default username “pi”, which users already create at the initial boot. However, for creating multiple users, you have to follow the below-mentioned guidelines that involve:
-
- Creating Multiple Users
- Switching a User
- Changing the User Password
- Deleting a User
All the above methods are crucial for users interested in creating multiple users on the Raspberry Pi system. Let’s talk about them one by one.
1: Create Multiple Users
Creating multiple users on Raspberry Pi is simple, which you can do using the following syntax:
Syntax
In the syntax below, you can assign any name for the new user:
Example
By running the above command, a new user “linuxhint” will be created and you will be asked to set a password for it:
After setting the desired password and retyping it, you will be asked for some basic credentials, enter those one-by-one. In the prompt question type y and your new account will be created successfully:
In a similar way you can create multiple users. Let’s create another user with the name user2, and for that, use the following command:
Just set a new password for the user, and answer the question in the same way as we did previously:
And a new user with the name user2 is created.
2: Switching a User
After creating multiple users, you can switch between the users by simply using the below-mentioned su command along with the user’s name.
Command Syntax
Example 1
After running the command, it will ask you for the password of the user. Enter the correct password and as a result, the user will be switched as highlighted in the below image:
Example 2
In this example, we will switch to user2 that we have created:
Similarly, it will ask for a password and the user will be switched to user2:
If you want to switch back to the default user pi, then just copy the below-mentioned command and enter the default password for pi.
3: Changing the User Password
After creating a user, if you forgot the password, you can simply change it anytime. To change the password of any of the users (even the default user), use the below-written command:
Syntax
Example
After entering the above command, you will be asked for a new password then re-type the new password and as a result, the password will be changed successfully.
4: Deleting a User
After creating a new user now if you do not need it any longer, you can delete the user by using the below-mentioned command:
Syntax
Example
Here I have deleted the user2.
Conclusion
The Raspberry Pi users can create multiple users using the adduser command, while they can switch to any users using the su command. However, if someone forgot a password for a username, they can change it at any time using the passwd command. At any time, they can also delete a created username from the Raspberry Pi system using the deluser command.