Setting Up a Raspberry Pi for Dev Side-projects

The Raspberry Pi is a great device for dev side-projects, such as a home media station, an IoT device, or a local server. Here are some of my go-to configurations when setting one up.

Booting with Connectivity

  • Create a wpa_supplicant.conf in the boot directory for wireless connections
  • Create a ssh file in the boot directory to enable SSH

OpenSSH

  • OpenSSH options are set in /etc/ssh/sshd_config

    # disable root login
    PermitRootLogin no
    
    # allow only specific users
    AllowUsers user1 user2
    
    # allow only specific groups
    AllowGroups groupA groupB
    
    # change sshd port number
    Port 123
    
    # change login grace time
    LoginGraceTime 1m
    
    # restrict the interface to login
    ListenAddress 192.168.1.123
    ListenAddress 192.168.0.456
    
    # disconnect ssh when no activity
    ClientAliveInterval 300
    ClientAliveCountMax 0
    

Security

Add User and Password

sudo /usr/sbin/useradd --groups sudo -m user123
sudo passwd user123

Reset Root Password

sudo passwd root

Disable Default Pi Account

sudo passwd --lock pi
Avatar
Nicholas Nadeau
Engineering Manager

Related