In this article we will cover everything from creating a user to deleting a user, in short this article will guide you on how to manage users on Raspberry Pi.
Step-by-Step Guide to Manage User on Raspberry Pi
The list of topics that we will cover here are:
- Creating New User
- Listing Users
- Switching to a User
- Changing a User Password
- Creating a Group
- Listing All Groups
- Adding a User to a Group
- Showing Group of User
- Listing All Users in a Group
- Deleting a User From Group
- Deleting a Group
- Deleting a User
The commands and description of each are discussed below.
1: Creating a New User
The first command in our list is to create a new user on Raspberry Pi. Multiple users can be created on Raspberry Pi. To create a new system user on Raspberry Pi, you can use the below-mentioned command:
Syntax
Example
Or use simple adduser command can also be used to create a new user in Raspberry Pi:
After running this command, you will be asked for a password for a new user and some information too which you can add if you want or else skip it by pressing Enter:
For further details about creating a new user follow the article.
2: Listing All Users
To list all the user that are part of your Raspberry Pi system, use the below-mentioned command:
If you are interested in getting the list of normal users on Raspberry Pi system, follow the below-given command:
3: Switching to User
After creating a user, if you now want to switch to a new user, you can use the below-mentioned command:
Syntax
Example
4: Changing a User Password
To change the password of any user, switch to that user using the su command.
Then use the passwd command to set a new password for the user.
5: Creating a Group
If you want to create a new group in your Raspberry Pi, use the below-mentioned command:
Syntax
Example
6: Listing All Groups
To display the list of all the system users’ groups in Raspberry Pi, just copy the below-mentioned command into terminal:
The output will show all the groups in the system as shown in the image below:
7: Adding User to a Group
In Raspberry Pi, some privileges are only for users that are present in a group, so to get the privileges of a certain group, you have to add a user to that group through the following command:
Syntax
Example
8: Showing Group of User
To find out the group of any user, switch to that user by using su command.
Then simply run the groups command and it will display the groups of that user
9: Listing All Users in a Group
To list the all the users present in any group, you can use the below-written command:
Syntax
Example
The output will display the users present in the mentioned group:
10: Deleting a User from Group
If you feel that you no longer need a specific user inside a group, you can delete the user from any group using the below-mentioned command:
Syntax
Example
11: Deleting a Group
And to delete a group, you can use delgroup command with the group name as shown below:
Syntax
Example
12: Deleting a User
To delete any user entirely from the system, use the the below-mentioned command:
Syntax
Example
Conclusion
Managing users is an essential part of the Raspberry Pi system. Different commands to manage users in Raspberry Pi are discussed in the above guidelines, which include the creation of a user or group, changing passwords for users, switching users, listing users or groups and other such related commands. The users can get help from these commands for easily managing the users on the Raspberry Pi system.