Contents

Raspberry Pi 101

1 Auto-join WiFi

Firstly, modify the network interface file sudo vim /etc/network/interfaces by adding these lines:

1
2
3
4
5
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Then, configure the WiFi connection details by modifying sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

1
2
3
4
5
6
7
8
network={
    ssid="NETWORK_NAME"
    psk="NETWORK_PASSWORD"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}

Now the Raspi should automatically join the WiFi upon booting.

2 Find Raspi’s IP Address

I do not have an extra monitor for the Pi and I do not feel like an extra cable messing up my desktop so I have to find the ip address through my PC by sudo nmap -sn 192.168.0.1/24 where 192.168.0.1 is the router’s ip and 0/24 ranges from 0 to 255.

From the list of found IPs, we can determine the Raspi’s IP address

3 SSH without Password

ssh-copy-id is a good tool to achieve login without password everytime. Simply brew install ssh-copy-id and then use it ssh-copy-id user@hostname. Now ssh to the Raspi should not require password ssh user@hostname. Finally, modify ~/.ssh/config by adding

1
2
3
4
Host pi
  HostName [IP of Raspi]
  User [username]
  Port 22

4 Tools