As far as I know, the name of default user “pi” cannot be changed, nor it can be deleted as it is the only user available by default.
User name change can however be achieved in following two steps. (1) First creat another user of desired name, and grant it sudo permission. (2) Next reboot Pi and login as newly created user, and delete “pi” user.
NOTE:
In the commands in screenshots below, I have used “abcd
” as <new_username>
(1) Create new user:
(1.1) Issue following command to (a) create new user, and (b) assign new user a password
sudo adduser <new_username>
(1.2) Give new user sudo permission by adding it to group sudo
sudo adduser <new_username> sudo
(1.3) Check if new user is created and added to sudo group
ls /home
groups <new_username>
Click on Screenshot to See Larger Size
(1.4) Running the sudo command requires a password, and if you want to remove the password restriction, run the following command:
echo '<new_username> ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/<new_username>
The above command will give following output:
<username> ALL=(ALL) NOPASSWD: ALL
Click on Screenshot to See Larger Size
(1.5) Check user “pi” is member of which groups by command “groups pi
”
Click on Screenshot to See Larger Size

(1.6) Add new user to those groups to which “pi” is a member
sudo adduser <new_username> piaware
sudo adduser <new_username> plugdev
sudo adduser <new_username> users
sudo adduser <new_username> netdev
sudo adduser <new_username> gpio
sudo adduser <new_username> i2c
sudo adduser <new_username> spi
sudo adduser <new_username> render
sudo adduser <new_username> input
sudo adduser <new_username> games
sudo adduser <new_username> video
sudo adduser <new_username> audio
(1.7) Check <new_username> is added to all above groups:
groups <new_username>
Click on Screenshot to See Larger Size
(2) If you want, you can now delete User “pi”
(2.1) Reboot Pi
sudo reboot
(2.2) On reboot, login as <new_username>, then if you want, you can delete user “pi” by following command
sudo deluser --remove-home pi
The above command will completely remove the username “pi” from your system and disable the SSH login from the username “pi”. If you want to re-access the SSH connection, you must provide your <new_username> and it’s password
Click on Screenshot to See Larger Size