Setting Up A New Raspberry Pi

Steps I do when I am setting up a new Raspberry Pi.

If using the official LCD screen, for some unknown reason, it still defaults to an upside-down orientation when hooked up. This is simple to fix. Edit /boot/config.txt and add the following line:

lcd_display=2

The 2 rotates it 180º (the most likely choice for most display cases). 1 would be 90º, and 3 would be 270º.

Go into raspi-config and enable ssh so you can access it from remote. Also, set you locale settings. Set the wifi-country, and choose your SSID config if you plan to use WiFi.

Patch it:

apt update ; apt upgrade 

Change the password for the pi and root accounts.

Create your own user if you don’t want to use the pi username:

useradd -g users -G $( grep pi /etc/group | cut -f 1 -d ':' | egrep -v "^pi$" | tr '\n' ',' | sed -e "s/,$//" ) -m sgarrett

That is one long line. It assigns the same groups to the new user account as the user pi has so you will already be set up with most of the system permissions you need.

Don’t forget to set a password for the account:

passwd sgarrett

Add a config to /etc/sudoers.d so you don’t have to enter your password to elevate your privileges:

cd /etc/sudoers.d ; sed -e "s/^pi/sgarrett/" 010_pi-nopasswd > 010_sgarrett-nopasswd ; chmod 0440 010_sgarrett-nopasswd

Set up the screen to have a cooler font and color.

Set up SMB shares:

apt install samba samba-testsuite smb4k smbc smbclient smbmap

Install the SAMBA suite and some useful tools.

Then, add the accounts you want to the samba password file:

smbpasswd -a sgarrett

Users are tracked in a separate database for samba, so a user has to be created in that database. PAM and SAMBA will synchronize when you change your password.

Edit the SAMBA config file /etc/samba/smb.conf to your own tastes. At a minimum, you will probably want to change the read only flag for the [homes] share to no so you can write to your home directory when you mount the share.

If you plan to mount shares from a Mac, you might want to add the appropriate settings.

Leave a Comment