Add new user in Raspberry Pi

Hey dreamers! Let’s talk on how to add new user in Raspberry Pi that has the same privileges as pi default user

Add new user in Raspberry Pi

1. First, login as pi default user and open terminal, then type the following command to add new user:

sudo adduser yourLoginUsername

Note: Replace yourLoginUsername with the username you want.

2. Type the following to get the group list of pi user:

groups

3. Add user to the same group as pi:

sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi yourLoginUsername

4. Locate /etc/sudoers.d and open 010_pi-nopasswd file and add the following:

yourLoginUsername ALL=(ALL) NOPASSWD: ALL

Warning!!!

a. Do not close nano with 010_pi-nopasswd after editing

b. Open another shell and try sudo command after each editing made on 010_pi-nopasswd. This is to make sure that there are no sudo errors

c. Just to repeat, do not close nano yet and always check for sudo errors, as mentioned in b

5. Enable login prompt during startup by typing the command below:

sudo raspi-config

Then, select option 5 Boot Options ==> B1 Desktop / CLI ==> B3 Desktop Requiring User to Login

6. Reboot your Raspi and use the new username to login

* Extra

* Disable a user from being able to login

sudo passwd -l targetUsername

Note: -l = lock the password of an account

* Delete a user and its home folder

sudo deluser --remove-home targetUsername

* Change password of a user

sudo passwd targetUsername

Leave a Reply

Your email address will not be published. Required fields are marked *

*