Skip to content

Instantly share code, notes, and snippets.

@mandyedi
Last active April 7, 2022 23:27
Show Gist options
  • Save mandyedi/7f7b10e640d3bb7cda50cf9df8f3727a to your computer and use it in GitHub Desktop.
Save mandyedi/7f7b10e640d3bb7cda50cf9df8f3727a to your computer and use it in GitHub Desktop.

Raspberry Pi Cheatsheet

Wifi Setup

  1. After the OS image is installed on the SD card, open it.
  2. Create an empty file named ssh
  3. Create a file named wpa_supplicant.conf with the following content.
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
	ssid="MyWiFiNetwork"
	psk="aVeryStrongPassword"
}
  1. Now you can ssh.
$ ssh pi@raspberrypi
# password: raspberry

Security

Change the ssh port

$ sudo vi /etc/ssh/sshd_config
# Find and edit this line:
# Port 22
$ sudo reboot

Change the user password

$ sudo raspi-config
# Select option: Change User Password fot the 'pi' user

Shutdown

$ sudo shutdown -h now

HDMI

https://www.raspberrypi.com/documentation/computers/config_txt.html

sudo vi /boot/config.txt

# Setting hdmi_safe to 1 will lead to "safe mode" settings
# This is the same as setting the following parameters:
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24

# Recommended for TV
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
hdmi_group=1
hdmi_mode=16
disable_overscan=1

hdmi_group

0 Auto-detect from EDID
1 CEA (Consumer Electronics Association, the standard typically used by TVs)
2 DMT (Display Monitor Timings, the standard typically used by monitors)

hdmi_mode

For CEA
16: 1080p 60Hz 16:9

Login rate limit

todo: fail2ban, use iptables?, other options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment