In this lesson we show how to add new users to the Raspberry Pi. The default Pi account on the Raspberry Pi has sudo access, which means that when logged on as “pi” you can pretty much do anything you want by accessing the sudo command prefix. In this lesson we do not add a sudo user, but just one that can pretty much do things in their account folder. To add another user named austin without sudo priviledges, you would use the command:
$ sudo useradd austin -m -s /bin/bash -g users
Then to assign a password, you would give the command:
$sudo passwd austin
Then enter the password when prompted.
In creating a new user in the “users” group, that new user can create and edit files in his folder (/home/austin), and can look at most things on the system, but can not change or add things outside his folder. To allow the user to have sudo privileges, he would need to be added to the sudo group.
To remove a user, you need to be logged into an account with sudo privileges, and then enter the command:
$sudo userdel austin
Which would delete the user austin. This command would delete the user, but would keep their files and folders (/home/austin), but the person could not log in any more. If you wanted to remove the user, and all their files, you would use the following command:
$sudo userdel -r austin
For this command, the user austin, and all his files are removed.