56tvmao: How-to instructions you can trust. PC Guides Going Beyond the Default Raspberry Pi Configuration

Going Beyond the Default Raspberry Pi Configuration

The default configuration for Raspbian on the Raspberry Pi is completely functional and allows you to jump straight in and start using your Pi from the command line or from the desktop. However, it is often desirable to move beyond the defaults. The first default you should probably change is the default password for the user “pi.” In a relaxed home environment, using the default password isn’t likely to cause much problem. However, if your Pi is in any way exposed to the Internet or used in a more public place, then changing the password is essential.

To change the password for the default user, log in using “pi” (username) and “raspberry” (password), and then type the following at the command line:

passwd

You will then be prompted for the current password (i.e. “raspberry”), and you will be asked to enter a new password. It is important to pick a good password, and using a common word isn’t recommended. You should avoid passwords like: 123456, password, qwerty, abc123, iloveyou, 111111, letmein, monkey, 123123 and princess. A strong password should use a mixture of uppercase and lowercase letters and include numbers and symbols. Alternatively, you can use a long sentences as mentioned here. Once you have entered the new password, you will need to enter it again as a confirmation.

If you have more than one person using the Raspberry Pi, then you can add additional users. This will give each user their own login credentials with their own home directory, etc. To add a new user use:

sudo adduser newuser

“newuser” will be the name of the user you want to add (e.g. sudo adduser gary).

You will be asked to enter the password for the new user (twice) and optionally enter some account information like the user’s full name, etc. If you want to give the new user permission to run system commands using sudo, then you need to edit the “/etc/sudoers” file. Type the following:

sudo visudo

Move to the bottom of the file and add this line:

newuser ALL=(ALL) NOPASSWD: ALL

Where “newuser” is the username of the user previously added via adduser. Exit nano using “Ctrl + x”.

If you want to change the password of a user (because they have forgotten it or you want to block their access to the account), then use the passwd command but with the username as the first parameter:

sudo passwd gary

The default name for your Raspberry Pi is “raspberrypi”. You can see it using:

hostname

Renaming your Pi requires two steps – first the “/etc/hostname” file needs to be changed, and then the “/etc/hosts” file needs to be edited. The first of these two files is used to set the hostname during boot-up. The second file lists the known hosts on the network and includes the local Raspberry Pi but under its default name.

Edit “/etc/hostname” as follows:

sudo nano /etc/hostname

Replace the word “raspberrypi” with the new name, e.g. “garypi” and exit nano with “Ctrl + x”.

To edit the “/etc/hosts” file, type:

sudo nano /etc/hosts

Find the line that reads:

127.0.1.1       raspberrypi

And change the word “raspberrypi” to the new name, e.g. “garypi” and exit nano with “Ctrl + x”.

Reboot your Pi with “sudo reboot” and check the name using the “hostname” command.

Other things you might consider doing include setting up Wi-Fi on your Pi and configuring a static IP address. If you have any questions about administering user accounts and altering the machine’s hostname, feel free to ask in the comments below.


Gary Sims

Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe

Related Post