How to Configure Your New Raspberry with ssh

What next? We got our new Raspberry to boot into Raspbian. We got logged in. Now, we need to configure a few things. First, change the password. The default password for the user “pi” is “raspberry”. Let’s change that so nobody can hack into our new computer! This is easy. The command is “passwd”. Type it at the prompt and answer the questions.

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $ passwd
Changing password for pi.
Current password:
New password:
Retype new password:
Sorry, passwords do not match.
passwd: Authentication token manipulation error
passwd: password unchanged
pi@raspberrypi:~ $ passwd
Changing password for pi.
Current password:
New password:
Retype new password:
passwd: password updated successfully
pi@raspberrypi:~ $

Blind typing is tough! Yes, it’s working. It’s just not displaying your secrets, in case someone is shoulder-surfing while you’re changing your password. If you get it wrong, just try again, like I did.

Next, check out “raspi-config”. This is a very powerful program. So powerful that you need to be an administrator or root of the Raspberry. Well, you can be for a fleeting moment. To run a program as root, precede the command with “sudo”. So we’ll run”

sudo raspi-config

We already did option 1 from the command line. You’ll find that there’s always more than one way to do things on a Raspberry – or in LINUX in general. Let’s look at option 2 Network Options. The popular option here is N1 that lets you change the hostname of your Raspberry. Hit enter on that and replace “raspberrypi” with something much better. If this is going to be a particular kind of server then reflect that in the name. If this is just going to be your experimental sandbox, name it so – or whatever your like. I’m calling mine “howto”

Also, let’s hit option 4. There’s a couple of good things to do here. Set your local in I1. The default is British English. I live in Maryland, USA so I’m switching to US English. Arrow down to

[*] en_GB.UTF-8 UTF-8

and hit the spacebar. Arrow down to

[ ] en_US.UTF-8 UTF-8

and hit the spacebar again. Tab to <OK> and hit enter. Arrow down to

en_US.UTF-8

on the subsequent page and hit enter. Give the Raspberry a moment to copy some files around. When it completes, it will bring the menu back. Let’s do Localization Options again, but this time, set the timezone. In my case, I’m in America/New_York. I arrow down to America, enter, hit “n” to jump and then arrow to New York. Enter invokes the magic. Finally, “7 Advance Options” and “A1 Expand filesystem”. Remember that we imaged this SD card that is our “hard drive”? Let’s let the Raspberry take over the rest of the space as our root drive. Hit enter on Expand Filesystem and the program will take full advantage of a larger SD card.

Command (m for help):
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x97709164
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 62333951 61801472 29.5G 83 Linux
Command (m for help): The partition table has been altered.
Syncing disks.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

So, the first half of the screen that flies by looks great! 30+ GB filesystem! W00t! But all those warnings on the bottom of the screen bug me. It’s just warnings, so you don’t really have to give it a second thought, but if it bugs you, I have the instructions to fix it here.

That’s enough monkeying around for now. Let’s reboot and put these changes into effect.

Author: John

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.