Raspberry Pi Server General Configuration
Changing Password
The default Raspberry Pi OS user is named pi, and the default password is raspberry. Any responsible person will at least change the password. That can be done with the passwd command.
The passwd command followed by no arguments will change the password of the current user account. The account whose password is to be changed can also be specified, but that requires root privilege.
pi@raspberrypi:~$ passwd
Changing password for piCurrent password:The user will then be prompted for his or her current password, which is raspberry in this case. However, if he or she has root privilege (is the root user or uses sudo) no password is needed.
pi@raspberrypi:~$ passwd
Changing password for piCurrent password:New password:Retype new password:passwd: password updated successfullyThen the user will be prompted to enter a new password and then confirm it by entering it again. If that is done successfully, the new password will be in place.
Changing User Account
As mentioned in the section above, the default user password should always be changed. Optionally, the default user account itself can also be changed. Although this is not necessary, a means of doing so is documented here.
The adduser command can be used to create a new user account. It must be run with root privilege and can be passed the name of the new account that is to be created. The command shown below creates a new account call my-new-account.
pi@raspberrypi:~$ sudo adduser my-new-account
Adding user `my-new-account' ...Adding new group `my-new-account' (1001) ...Adding new user `my-new-account' (1001) with group `my-new-account' ...Creating home directory `/home/my-new-account' ...Copying files from `/etc/skel' ...New password: Retype new password: passwd: password updated successfullyChanging the user information for testEnter the new value, or press ENTER for the defaultββββFull Name []: Various And SundryββββRoom Number []: 27ββββWork Phone []: 1-800-ITS-UNIXββββHome Phone []: 1-800-MYHOUSEββββOther []: Is the information correct? [Y/n] YOnce a new user has been created, it should be added to all of the groups that the user pi was a part of. That can be done by editing the file /etc/group. Editing this file requires root privilege. Assuming that the user pi will be deleted, we can modify each line that ends with pi by replacing pi with the name of our new user. Below is a before and after table in which pi is replaced with an account called my-new-account.
Before |
After |
|---|---|
|
|
|
Then log into the new account and delete the old account. The commands needed to do this are shown below.
pi@raspberrypi:~$ sudo su my-new-user
my-new-user@raspberrypi:~$ sudo userdel pi
Updating the System
Finally, we shall update the system.
We will run sudo apt-get update to update the local list of available packages.
We can also run sudo apt-get upgrade to update all of the installed packages. This is not necessary, and it can take quite a while and use a reasonable amount of disk space, depending on how old the operating system is. I often omit this step, but I am using a reasonably up-to-date version of Raspberry Pi OS, so I ran it this time.
my-new-user@raspberrypi:~$ sudo apt-get update
Lots of output that I will not put in this web page.my-new-user@raspberrypi:~$ sudo apt-get upgrade
Lots and lots of output that I will not put in this web page.Now I consider the Pi to be configured. The next article will discuss installing the Apache Web Server, something actually related to web development.
| Previous | Published December 16, 2020 | Next |
|---|