/ SOFTWARE, LINUX, PI, RASPBERRY, RASPBIAN

Boilerplate Raspbian Setup

I tend to flash my raspberry pies a lot. Here are the steps I follow to get to my working state.

  • Flash with latest raspbian image https://www.raspberrypi.org/downloads/raspbian/
  • Add an empty file named ssh to the boot folder
  • Add an empty file called wpa_supplicant.conf
  • Configure the wireless by creating a file called wpa_supplicant.conf
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_real_wifi_ssid"
    scan_ssid=1
    psk="your_real_password"
    key_mgmt=WPA-PSK
}
  • Ssh onto the pi with pi@hostname raspberry
  • Update system and Install vim.
      sudo apt update && sudo apt full-upgrade -y
      sudo apt-get install vim
    
  • Create my user on the pi
      sudo adduser username
    
  • Add my user to the sudo’s file.
    •  Create a new file named 020_username_nopasswd  in /etc/sudoers.d
    • Edit the file as.
        username ALL=(ALL) NOPASSWD: ALL
      
  • Add my certificate to ~/.ssh/authorized_keys
      sudo su username
      cd ~
      mkdir .ssh
      cd .ssh
      vi authorized_keys
      cd ~
      chmod 700 ~/.ssh/
      chmod 600 ~/.ssh/authorized_keys
    
  • Disable password authentication
    • Edit file /etc/ssh/sshd_config
        PasswordAuthentication no
      
    • Restart ssh server

        sudo /etc/init.d/ssh restart
      
  • Remove User pi

      sudo deluser -remove-home pi
    
  • Add alias to ~/.bashrc

      alias ll='ls -al'
    

References