Open xyzarivera opened 8 months ago
hostname
: custom
username
: preferrably, the same username as main machine (mac machine)
Enable SSH - Allow public key authentication only
ssh [username]@[hostname].local
[username]@[hostname].local: Permission denied (publickey).
Public key used during setup did not match from default public key based on ~/.ssh/config
in the main machine
Apparently, I have 2 ssh keys, default
and key_2
. The RPi Imager, pre-filled the input field with key_2.pub
.
~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/default
Host github.com
Hostname ssh.github.com
Port 443
Add key_2
to the main machine's ~/.ssh/config
as the assigned ssh key for the RPi
Host <hostname>.local
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/key_2
Update the RPi's ~/.ssh/authorized_keys
to have the default
ssh key, using this cli command in the main machine.
ssh-copy-id -i ~/.ssh/default.pub [username]@[hostname].local
Raspbian is a Debian-based OS. Checked for commands under this distro.
shutdown -h now
It would be nice that I wouldn't need to use a monitor every time I will add a wifi network to connect to.
As of writing, Raspberry PI documentation on connecting to wireless networks says that creating a wpa_supplicant.conf in the SD card's root directory will not work from Raspberry Pi OS Bookworm onwards.
I tried several attempts already to resolve this but it seems most forum posts are outdated.
This will still be an option but it would still need a monitor.
NetworkManager (nmcli) allow network configuration in the cli. Feels painless since I can initially connect to the Pi via my phone's hotspot to add a new network, then connect to that network after set up.
nmcli c add type <network type> con-name <connection name> ifname <inteface> ssid <ssid>
nmcli con modify <connection name> wifi-sec.key-mgmt <key-mgmt>
nmcli con modify <connection name>wifi-sec.psk <password>
nmcli con up <connection name>
nmcli con delete <connection name>
nmcli dev wifi connect z password ptclptcl hidden yes
nmcli c add type wifi con-name home-wifi ifname wlp61s0 ssid z
nmcli con modify home-wifi wifi-sec.key-mgmt wpa-psk
nmcli con modify home-wifi wifi-sec.psk ptclptcl
nmcli con up home-wifi
nmcli con delete home-wifi
nmcli dev wifi connect <ssid> password <password> hidden yes
Note: WPA2/WPA-3 Personal is under wpa-psk
key management
nmcli c delete SSID
nmcli d wifi - list all wifi available
nmcli d wifi connect SSID password “ssidpassword” - quotation marks required
nmcli d - list connected networks
Overview
This ticket is my progress tracker for setting up the raspberry pi which will host the app I'm creating.
Goals