#RaspberryPi – How To automatically connect to WiFi, enable SSH on 1st boot, SSH connect and update!

Buy Me A Coffee

Hi!

If you been playing around with Raspberry Pi, I’m sure you already know this. For me this was a 1st timer, so I must write this down for the future myself.

When I started testing the Raspberry Pi 4, I got one of the complete kits, so I got the official red keyboard and mouse.

raspberry pi 4 official keyboard and mouse

I figure out I also need a couple of extra video cables. Now we need a [Micro HDMI to HDMI Cable] to connect one of the 2 video outputs to an external monitor.

This is the (cheap) monitor I’ve been using for a long time, however by default the RPi does works in a valid resolution for this monitor.

raspberry pi 7 inches monitor

And, the 2 main tasks you perform when you start your RPI are

  • Configure Wireless Connection
  • Enable SSH

Of course, you can do this directly in the SD with the Raspbian image (see references). And it’s also very easy to do.

You need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk]

Important: This only works the first time you boot the Raspberry Pi with the SD card. The SO search for [wpa_supplicant.conf] and performs the connection. If you already booted the device, you need to create a bootable SD card again.

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 10.184.1.231, so now I can use any SSH client (like Putty, see references) to connect to the device. As usual the default credentials are

  • user: pi
  • password: raspberry

You can now start working with your Raspberry Pi !

Of course, at this moment you should change your default password and update everything with a command like this one

sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

Happy coding!

Greetings @ Toronto

El Bruno

References

Advertisements

#RaspberryPi – How To automatically connect to WiFi, enable SSH on 1st boot

Buy Me A Coffee

Hi!

If you been playing around with Raspberry Pi, I’m sure you already know this. For me this was a 1st timer, so I must write this down for the future myself.

When I started testing the Raspberry Pi 4, I got one of the complete kits, so I got the official red keyboard and mouse.

raspberry pi 4 official keyboard and mouse

I figure out I also need a couple of extra video cables. Now we need a [Micro HDMI to HDMI Cable] to connect one of the 2 video outputs to an external monitor.

This is the (cheap) monitor I’ve been using for a long time, however by default the RPi does works in a valid resolution for this monitor.

raspberry pi 7 inches monitor

And, the 2 main tasks you perform when you start your RPI are

  • Configure Wireless Connection
  • Enable SSH

Of course, you can do this directly in the SD with the Raspbian image (see references). And it’s also very easy to do.

You need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk]

Important: This only works the first time you boot the Raspberry Pi with the SD card. The SO search for [wpa_supplicant.conf] and performs the connection. If you already booted the device, you need to create a bootable SD card again.

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 10.184.1.231, so now I can use any SSH client (like Putty, see references) to connect to the device. As usual the default credentials are

  • user: pi
  • password: raspberry

You can now start working with your Raspberry Pi !

Of course, at this moment you should change your default password and update everything with a command like this one

sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

Happy coding!

Greetings @ Toronto

El Bruno

References

#RaspberryPi – Using “please” instead of “sudo”, a very Canadian command line of work for #Linux

Hi!

I’ll write this down, so I don’t forget in the near future. I’m not a Linux user, and that’s amazing. Every day I learn something new, mostly while I’m working with Python, Visual Studio Code and Raspberry Pi.

So, I received a couple of brand new Raspberry Pi 4, and now it’s time to test them. And of course, most of this job is via SSH / command line. I’m not an expert (yet) on Raspberry Pi user permissions, however I started to realize when I need to use “sudo” to get things done.

If you search for sudo definition, you may find something similar to this one:

Sudo stands for either “substitute user do” or “super user do” (depending upon how you want to look at it)

https://www.lifewire.com/what-is-sudo-2197466

Today, I’ve learned the power of the “alias” command, and how it can be used to have a more polite conversation with my device. In example, I can create an alias for sudo, named “please” and then this happen.

alias please="sudo"

This is a very polite way to display my Raspberry Pi4 CPU information

raspbery pi 4 using please instead of sudo display cpu information

Or another polite way to display Disk information for the Raspberry Pi 4

raspbery pi 4 using please instead of sudo display disk information

You get the idea.

Happy Coding!

Greetings @ Toronto

El Bruno

Twitter source

#MacOs – Where is my Putty? Utilizando SSH y RealVNC para conectar con #RaspberryPi [experiencias en Mac de un long time #Windows user]

Buenas !

En mi post anterior escribí sobre mis experiencias en el nuevo mundo de MacOS. Soy un novato total en este mundo y estoy aprendiendo sobre la marcha para poder ser productivo en mi día a día en Avanade y en mis hobbies y actividades personales.

Al igual que en mi post anterior, la siguiente necesidad surge para una demo en un evento de Machine Learning: conectar con una Raspberry Pi utilizando SSH. Esto lo hago como parte de mis demos de Custom Vision. (Y una vez mas, comentare que Custom Vision es uno de los mejores servicios de la familia de Cognitive Services)

En una parte de mi demo exporto un proyecto de Custom Vision como un proyecto de Docker para Linux. Luego modifico el mismo para poder compilarlo en Docker en Raspberry Pi.

En casa y en modo de prueba, suelo acceder a la Raspberry PI utilizando RealVNC, y por suerte, este producto esta disponible en ambas plataformas Windows y Mac. Otra opción es acceder a la Raspberry Pi utilizando SSH (SSH stands for Secure Shell). Esta opción es mas útil en demos, ya que es mas simple de compartir y explicar el paso a paso que se sigue en una consola de comandos.

En Windows, he sido un usuario longevo de Putty. Poco hay que decir al respecto, es una aplicación simple y poderosa para conexiones SSH, Telnet y puertos series. Al momento de ver si estaba disponible para MacOS, la descripción del producto dejo claro que NO.

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

Llego el momento de realizar un par de búsquedas en Bing para ver alternativas de Putty para MacOS. Fue mucho mas simple de lo que pensaba. Pocos minutos después, pude ver que con la app Terminal de MacOS me podía conectar rápidamente a mi Raspberry Pi con el siguiente comando

MACTERMINAL:~ bruno.capuano$ ssh <DEVICE IP> -l <LOGIN NAME>

Fue utilizar el comando, con la dirección IP y las credenciales de acceso a mi device y listo. Prompt para la contraseña y ya estaba conectado a mi Raspberry Pi.

01 doker build on mac

Espero que las próximas también sean así de fáciles !

Happy coding!

Greetings @ Burlington

El Bruno

References

#MacOs – Where is my Putty? Need for SSH and RealVNC to connect to #RaspberryPi [experiences in Mac from a #Windows user]

Hi !

In my previous post I share the context on why I’m a total newbie into the MacOS world. So today, I want to share another experience when switching from Windows to Mac.

As my previous content, the need for a SSH client is based on my live demos on my Custom Vision event. (Remember, Custom Vision is one of the most amazing services in the Cognitive Services family)

At some part on my demo, I create a new Custom Vision project, I export the project as a Docker for Linux, and I make some changes to the Docker Image to be compiled and used on a Raspberry Pi.

I can access and control the Raspberry PI using RealVNC, which is available for for Windows and Mac, or I can also access the device using SSH (SSH stands for Secure Shell). The second option is usually more appealing, because is just a big console app and everyone can read the commands sent to the device.

So, on Windows I was using Putty for a long time. It’s very light and easy to use. However, the description of the product makes a very clear statement about the supported OS of Putty.

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

It was time to hit Bing and search for options or alternatives to Putty on MacOS. And this one was easy. After a couple of minutes I realized that I can use the standard MacOS terminal to connect to my device using SSH with a command like this one

MACTERMINAL:~ bruno.capuano$ ssh <DEVICE IP> -l <LOGIN NAME>

Once you enter the ssh command, with the IP and and the login name, it will promtp for the password and that’s it! I’m now connected to my device

 

01 doker build on mac

This one was easy !

Happy coding!

 

Greetings @ Burlington

El Bruno

References