I hope that you are aware of Raspberry Pi and have a working Raspberry with Raspbian installed. Now if you want to add new user, Grant sudo access to this user and then delete a specific user, please follow this blog.
If you are not aware of Raspberry Pi, then please check the blog “What is Raspberry Pi ?” and then to install OS(Raspbian) on Raspberry Pi check the blog “Starting/Booting Raspberry Pi“. You may also purchase a new Raspberry Pi(Purchase single unit or full package[recommended]) from amazon.
Adding new user on Linux
Note :- It has been assumed that you have logged in as default user pi which has sudo access. If you are logged in as root you can omit the usage of sudo.
You may add new user by the following command. Fill in all the required information or press enter to skip. For example we will add a user named shashank.
sudo adduser shashank
Now you may switch to this user by giving in the following command.
sudo su shashank
Note :- su means switch user
Grant Sudo Privileges to this users
Note :- sudo menas substitute user as. Here we are substituting our user as root to get the privileges of root user.
On Raspberry Pi you may add the new user to the sudo group to give them the sudo access. For example let us consider the group name as sudo and user name shashank.
sudo usermod -aG sudo shashank
Note :- -aG means add user to the group.
Now you can use sudo with this new created user.
Create a New User and Assign sudo Group in One Command
You may also use this single command to create a new user and add it to the sudo group.For example let us consider the group name as sudo and user name shashank.
sodo useradd -G sudo shashank
Deleting a user
You may login as root or any user which has sudo access to delete a user. While using root there is no need to use sudo keyword. For example let us consider the user name shashank.
sudo deluser --remove-home shashank
Note :- If you want to reset password for any user then please follow the blog “Raspberry Pi password management : How to reset passwords on linux“.