Customize your WLAN Pi

In this article, I will show you how you can customize your WLAN Pi and make it your own! Feel free to comment and tell me how you guys customize yours.

Here is the video tutorial that explains these customizations.

CREATE YOUR OWN USER

Creating your own user allows you to have your own password and your own home directory. It is more secure and you are free to modify your profile as much as you want.
Note: I would also recommend you to change the default password for the wlanpi account.

In order to create a new user, you need to ssh into the WLAN. By default, if you connect the WLAN Pi to your laptop via the USB connection, this should establish an Ethernet over USB connection and your laptop should receive an IP address in the 192.168.42.0/24 IP address subnet.

You can now ssh into the WLAN Pi from your laptop using the default username and password:

  • Username: wlanpi
  • Password: wlanpi

Once connected, we will create a new user and give this new user some privileges.

  1. Use the following command to create a new user: sudo adduser username
  2. In the following prompts, specify which password you want to use for this user
  3. Use the following command to give this user sudo privileges: sudo usermod -aG sudo username
  4. Finally, try to connect using this new username and password: su – username

Finally, we will modify the user PATH so we can get access to some basic commands such as ifconfigiwconfig or iw.

  1. In the home directory of the user, open the .profile file using the following command: sudo nano .profile
  2. Modify this file by adding the following line at the end of the .profile file:  PATH=$PATH:/sbin:/usr/sbin
  3. Save and close the .profile file
  4. Once back in the shell, reload the profile using this command: source .profile
  5. You should now be able to use the ifconfig command

CHANGE THE HOSTNAME OF THE WLAN PI

The name of the WLAN Pi is configured under the /etc/hostname file. In order to change the hostname permanently, you will have to modify this file:

  1. Open the file using the following command: sudo nano /etc/hostname
  2. Modify the hostname to your liking
  3. Save and close the /etc/hostname file
  4. Reboot the WLAN Pi
When the WLAN Pi comes back online, you should be able to ssh into it and see the new hostname. The new hostname will also appear on the home screen:

One more thing you need to do here. You need to change the hostname used for dns resolutions. If you don’t, you will realize that it takes longer for sudo commands to execute. To do so, open the /etc/hosts file and replace “wlanpi” by your new name:

127.0.0.1	localhost	SemFioPi
::1			localhost	SemFioPi	ip6-localhost	ip6-loopback
fe00::0		ip6-localhost
ff00::0		ip6-mcastprefix
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters

CREATE YOUR ALIASES

On linux, an alias allows you to create your own command shortcut. For example, instead of typing ls –color=auto, you could create the following alias : alias ls=’ls –color=auto’. Then when you type ls, it will execute the full command line.

Everyone has their own set of aliases they like to use. Here I will just share the ones I use. Feel free to use them as well and feel free to create your own.

In order to create your aliases, you need to do the following:

  1. ssh back to the WLAN Pi using your new user: ssh francois@192.168.42.1
  2. Once connected to the WLAN Pi, modify the .bashrc file using the following command: nano .bashrc
  3. Add your aliases at the end of this .bashrc file
  4. Save and close the .bashrc file
  5. Reload your bash profile using the following command: source .bashrc
  6. Validate that your aliases have been applied using the alias command.
Here is the list of my aliases:
# Francois' Personal Aliases
alias l='ls -pG -l'
alias la='l -a'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias cate='cat -e'
alias cl='clear'
alias h='history'
alias j='jobs'
alias fg1='fg %1'
alias fg2='fg %2'
alias fg3='fg %3'
alias fg4='fg %4'
alias n='nano'
alias sn='sudo nano'
alias mtr='sudo mtr'
alias grep='grep --color=auto'
alias ifcw0='ifconfig wlan0'
alias ifcw1='ifconfig wlan1'
alias ifce0='ifconfig eth0'
alias iw0='iwconfig wlan0'
alias iw1='iwconfig wlan1'
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
alias mtr='sudo mtr'

CUSTOMIZE YOUR PROMPT

You can also customize your prompt to your liking. You can go wild here. I actually like it simple. I like the default prompt. I just changed the colors for fun!

In order to change the look of your prompt, you can do the following:

  1. From the WLAN Pi and from your user home directory, open the .bashrc file using the following command: nano .bashrc
  2. Inside the .bashrc file, scroll down until you find the PS1 variable. Then replace the value of that PS1 variable with whatever you would want to use.
  3. Save and close the .bashrc file
  4. Reload your bash profile using the following command: source .bashrc
Here is the PS1 value that I used for mine:
PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;202m\]\u\[\033[00m\[@\[\033[36m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
You can use the following website to customize your prompt to your liking: ​https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/

CHANGE THE PICTURE DISPLAYED WHEN BOOTING

When the WLAN Pi, you can see an image appearing on the screen. By default, it is the logo of the Wireless LAN Professionals company.
However you could change it to something else if you want to.
First, you need to retrieve the original image used. It is located on the WLAN Pi at the following location: /home/wlanpi/NanoHatOLED/BakeBit/Software/Python/wlanprologo.png
In order to retrieve this image, I used the scp command from my laptop. This command allows you to copy files from the WLAN Pi to your laptop over an SSH connection. Here is the command I used:
scp francois@192.168.2.2:/home/wlanpi/NanoHatOLED/BakeBit/Software/Python/wlanprologo.png .
This will copy the image on your laptop. Then I studied the picture and retrieve the resolution of it: 128 x 64.
Once I knew the resolution, I created my own image using Illustrator. I actually created the two following ones:
So first, you need to transfert the new image back to the WLAN Pi. I transfered mine back to my home directory using the following command:

Then you need to replace the image that’s currently on the WLAN Pi with your new image, freshly created. You won’t be able to do it in one shot because you don’t have the permission to do so over scp.

scp WLANPi-SemFio-StartUp.png francois@192.168.42.1:~/

Second, you need to ssh back into the WLAN Pi.

​And finally, you need to replace the old image with the new one. I used the following command to do so: sudo cp WLANPi-SemFio-StartUp.png /home/wlanpi/NanoHatOLED/BakeBit/Software/Python/wlanprologo.png

Note: It is very important here that you use the same destination name. The picture name will still be the same as before (wlanprologo.png) but its content will be different. I tried to do it a different way by changing the configuration files of the NanoLED program, but it didn’t work properly.

Then, you can reboot your WLAN Pi, you should see the new picture when the WLAN Pi boots.

IDEAS

If you manage multiple WLAN Pi, you could also create a Python script that you could run on multiple WLAN Pi to speed up their configurations and customizations.

In order to improve this customization, I would like to create a Python script that automates all of these tasks. I will then be able to run the script every time I update my WLAN Pi to a newer image and I will be able to retrieve my customizations.

Please share how you like to customize yours!

Thank you for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *