Creating a New User and Changing Username/Password on Raspbian

Reasons Why

A great reason to do this is increased security. On a fresh copy of Raspbian, your username and password will be ‘pi’ and ‘raspberry’. You may have projects that are more public and require a bit more security.

Creating a Brand New User

The first thing we do is create the new username.

sudo useradd yournewusername

Now create a password for that new user.

sudo passwd yournewusername

Now you’ll want to create a home directory for your new user.

sudo mkdir /home/yournewusername
sudo chown yournewusername:users /home/yournewusername

Changing your Username

usermod -l yournewusername -d yournewusername -m pi

Note - The use of ‘pi’ above is a placeholder for the username you are replacing, for a lot of us that will be ‘pi’.

Changing your Password

This one is easy, type the following command…

sudo raspi-config

Once the config menu displays, you should see ‘Change User Password’ as an option. Select this option and change your password as desired.