Posted on Leave a comment

RaspberryPi – Keyboard and Mouse Sharing 2

How to start the Keyboard and Mouse sharing tool Barrier from a SSH Command line.

Nothing is worse than having your Keyboard and Mouse sharing working but having to USB swap your keyboard when, for some reason or another, your Barrier install disconnects. With a few pieces of knowledge, you can ditch the second Keyboard and never USB swap again.


  • ssh server running on the target RaspberryPi
  • Ability to login as the same user running the desktop on your RasberryPi
  • barrier installed on both machines.

Bare Bones Attempt

If all is well on your systems, this “might” work. Each line is a command. You will have to take the IP address from line 2 and plug it in to line 4 where you see my IP.

hostname -I
ssh pi@raspberrypi
barrierc --name raspberrypi --enable-crypto --display :0

barrier, barrierc, barriers

The barrier tool is in actuality multiple programs.

barrier – A “wrapper” that runs th GUI

barrierc – The Barrier client

barriers – The Barrier server

The barrier command does not have an command line ability and simply launches the GUI which in turn launches the client or server as per chosen options. We will run the barrier client on the raspberry pi

To begin SSH to your RaspberryPi, it should looks something like this:

ssh pi@

Identify the Client “Screen”

RaspberryPi runs a system called X. In order to connect the client to the proper desktop display we need to get something known as the display number. We can use the command w to get this information. Simply type W at the command line

pi@raspberrypi:~ $ w
 11:37:04 up  6:24,  3 users,  load average: 0.04, 0.10, 0.09
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               08:19    6:24m 39.88s  1.03s /usr/bin/lxsess
pi       tty1     -                07:04    4:31m  1.38s  0.51s -bash
pi       pts/0    11:35    0.00s  0.58s  0.04s w
pi@raspberrypi:~ $ 

The two most important pieces of information are from the columns USER and FROM

We want the first entry in the list, it is the user on tty7, user pi, you can see it is connected to the display :0 under the FROM column. This is why we used pi from ssh, to guarantee we have the same permission and access to the screen.

Let’s see the command and breakdown each option.

barrierc -f –debug INFO –name raspberrypi –enable-crypto –display :0

barrierc – This is client binary


Runs the command in the foreground, useful for getting things going so we can kill the client easily.

–debug INFO

provides information about what is happening, feedback.

–name raspberrypi

This is the name that you must add on the server config


The transmission of the mouse and keyboard data should be encrypted to avoid interception. The server is enabled by default and you will not be able to connect the client without this turned on.

–display :0

This is the X-Server display number the client is going to control keyboard and mouse for. This is the key difference when executing a graphically element from a desparate console. The barrierc program needs to be told what Desktop it is going to work with.

Normally the barrierc program is executed from within the desktop/windowing system that it is targeting so you don’t need to tell it, but as we are starting it remotely we need indicate the display number.

Barrier Server IP and Port Number

Posted on Leave a comment

If you have not learned systemctl, you need to!

My server for this machine is low memory and the msyql piece craps out all the time. At this point when the site is unresponsive, I don’t even question what the issue will be. One command later and it is running again. After a largely useless legal warning.

Here is the magic command:

systemctl -H restart mysql

The -H is the magic. This new service controller for system has built in ssh-ing abilities. You will need to provide a password if you have not set up your private keys.

And if I need to check up on the service, same command just with status:

systemctl -H status mysql

For reference the old process would have been

service mysql restart

I know it doesn’t seem like a lot but, some of you will understand.

Posted on Leave a comment

Keyboard and Mouse Sharing – Linux + Pi

Bare Bones Install Instructions ( It just worked. ) The bare minimum to get a working installation of the Keyboard+Mouse sharing software Barrier. This can also be used from a Windows machine to a Linux machine or Raspberry Pi.

Barrier – A simple Open Source tool that enables sharing a Keyboard and mouse acrros muliple screens.

Linux Mint 19.x – Install

sudo apt update

sudo apt install snapd

sudo snap install barrier

Raspberry Pi – Install

sudo apt update

sudo apt install barier

Linux Mint 19.x – Run


Raspberry Pi – Run


Configure “Server”

In this installation the Server is the Linux 19.x machine. The machine with the Keyboard physically attached is the server. Place the screen in the correct position ( Each screen represents the whole PC, not the actual screen count .) The name of the machine must match the hostname on the raspberry pi. This will be shown in “Screen name:” of the client”

Once you have finished configuring the server, click the Apply button an then the Start button. The start button will change to a “Stop” button and the screen will show “Barrier is running” in the bottom left corner.

Configure Client

You will need the IP Address of the Server from the Server’s Main Screen. Uncheck “Auto Config” enter the IP address. Re-Check Autoconfig. As before press Apply and Stop. The client will connect and you will be able to move your mouse across both screens. ( Try re-starting server-side if it doesn’t work )


  • Your mouse point must be on the screen to which you are typing.
  • If the client dis-connects first try restarting the server.
Posted on Leave a comment

WordPress Next Stage Social Sharing – Using AddToAny alongside Jetpack.

In my previous post, I walked through a description of the built-in sharing provided by Jetpack. Jetpack adds sharing directly to the publishing workflow. It also adds some helpful preview features. What it lacks is a large selection of social media sites.

To compensate I have added AddToAny as part of my must-have plugins. AddToAny provides easy to use icons for many Social Sharing websites. In particular, I was looking for a plugin that included MeWe, and AddToAny did not disappoint.

Jetpack automates my most prominent social sites, with AddToAny I need to click on the link and manually share, but add2any makes this a seamless process with only a few clicks.

The setup is very straight forward with a large number of services to choose from. You can activate each service with a single click.

I chose a handful of common services

There are a significant number of display options. I have it set only for posts.

If you are looking to get direct follows from your Website Add2Any includes a follow widget for users of your website to click. The widget includes additional services like Instagram, YouTube, and others:

AddToAny is a very popular add on and a great addition to your arsenal of tools.

Posted on Leave a comment

Maximize your WordPress Efforts

Using Jetpack to “echo” your blog post to various platforms like Facebook and Twitter.

As any WordPress user, you have probably been through the routine. Create a post, share to Twitter, share to Facebook, share to a hundred sites to try to improve your traffic. I am here to tell you there is a solution. It is a service offered by WordPress themselves, it is called Jetpack.

You can find the plugin here:

Jetpack is sort of a Backend to WordPress that adds a good number of features and services that make it pretty much indispensable. It has a free tier and a paid tier. For most of my sites, I simply use the free tier and fill in the voids with other plugins.

While Social Sharing can be handled by many other plugins I have found the dead-simple integration by Jetpack to hit the mark. I have tested out other plugins only to be frustrated by a cumbersome interface or process or even outcome.

When you connect to Jetpack you will get a new icon in your post properties, it is a little green circle with two triangles:

Selecting the Jetpack icon swaps out the panel and shows the Jetpack panel. The first detail on the panel is the “Share this post.” Section. As you can see this site automatically shares four social sites that are included in the free version of Jetpack.

Once these are set, nothing else needs to be done. All your posts will be automatically shared on all these social sites. There are more available in the paid version.

The next item available is Social Previews. In the past, I played the post/delete/post again game when my post did not appear correctly on the social site. Now I have the habit of checking the preview before I post.

The preview for this post looks like this:

If you have added a post that is more narrowly targeted, you can disable sharing and only include the social sites that are appropriate for that post.

It seems that Jetpack only supports these four platforms, I had hoped for more but I’ll take what I can get.

Posted on Leave a comment

A Walk in the NextCloud – Docker Rescues NextCloud

Pi 3 on a 30 Year old Green Screen

A first look at running NextCloud in a Docker Container on a Raspberry Pi. The short answer is yes, it is simple. The qualified answer is, it is likely only useful for fun, testing, and one user.

Trying to set up a NextCloud server on a spare Raspberry PI in part of my journey away from the public cloud. An older Raspberry Pi I got stuck on the PHP 7.2 requirement. Spent more than an hour trying to upgrade and felt I wasn’t getting anywhere so I decided to turn to Docker. After all, this is what Docker excels at, package up all the dependencies that each piece of software needs.

So I hit up Docker hub to see if an image was available. Sure enough, there is and it has 500M downloads !!!!

One run command later and I am getting the image onto my aging Raspberry Pi 3 ( let’s see how it handles this. ) I had previously test openhab on this machine, which should explain the name. Eventually, I think I need to rename it to randallcloud or something more clever.

After a bit, I list the containers and boom, NextCloud is running.

It seems the Docker instance of Next Cloud took awhile to settle but after a few minutes ( Raspberry PI3 seems too slow for this. ) I can browse to the login page.

Based on the warning I thinking moving off of SQLLite will be one of the next steps.

So now I just need to add a Admin User name and password, and I think that is all.

The user is created and NextCloud moves on to install the default apps.

In a short time I am presented with a Dashboard, time to test it out!

Next I added an account to be used with my phone and I was able to login. This couldn’t have been easier.

Posted on Leave a comment

Rasberry Pi – Python Blink

Make a single LED Blink using Raspberry PI GPIO and Python.

Using the RPi.GPIO library we can program the LED to blink on and off. The GPIO library gives us easy access to the Pins of the Raspberry Pi.

Take a moment to print out this guide, with a custom template to make hookup dead simple.


  • A Raspberry Pi 2/3/4
  • A single LED
  • 2 Hookup Wires
  • A 2.2K Ohm Resistor
  • Prototyping Breadboard
  • A Raspberry Pi with Rasbian Installed and Running
  • Access to the Shell on the Raspberry Pi

First Let’s Wire Up the Pi and the LED

Get Ready

It can be extremely useful to get a PIN template and push it onto the Pins of the PI

I got mine from her :

Raspberry Pi GPIO paper-template

It is a actual sized and designed to pushed on the pins. Inlcuded in this article is a template custom labelled for this project.

Hook-Up Wires

It is easiest to use hookup wire that has one female end and one male end. The female end is easily pushed onto the RaspberryPI pins and the male end is easily inserted into the Breadboard.

1.) Connect One hookup wire from Pin 6 GND on the Raspberry Pi to Column 10 on the Breadboard

2.) Connect One hookup wire from Pin 7 GPIO 4 on the Raspberry Pi to Column 5 on the Breadboard

3. )Place the LED with the Short Lead, the Anode, inserted into Column 10 and the Long Lead, the Cathode into Column 9 on the Breadboard.

Identify LED Parts

  • The Anode of the LED can be identified in three ways.
    • It is the Long LEAD/Wire
    • The Lens will be rounded ( flattened side is cathode )
    • Looking into the led, the Anode is the “Post” the smaller metal bit.
  • The Cathode of the LED can also be identified in three ways.
    • It is the Short Lead/Wire
    • The Lens will have ( usually ) a small flat spot.
    • Inside the Lens the wire connects to the “Anvil” or the larger metal piece.
  1. Place the resistor from Column 9 to Column 6 on the Breadboard. The resistor has no polarity, so it can be connected in either direction.

That’s all it takes to hook up the LED.

The resistor is a used to limit the amount of current that goes through the LED, it protects the LED from ever getting to much current and burning out.

To aide with wiring here is a diagram from Fritzing:

Now Let’s Add Code

Log on to your Pi using the Pi Desktop or using SSH to get to a Terminal.

Place the following code into a file named ( or whatever name you like ), you just copy this code into your text editor or open your text editor and type it in.

import RPi.GPIO as GPIO 
from time import sleep
GPIO.setup(7, GPIO.OUT, initial=GPIO.LOW)

while True: 
    GPIO.output(7, GPIO.HIGH)
    GPIO.output(7, GPIO.LOW)

Once you svae the code you can execute the project as follows:


To stop the code from running press


Additional Activities

Blink Faster or Slower

To make the LED blink faster you can experiment with different values within the Sleep( ) command.

Try changing the value in Sleep to .1, it should look like this

while True:
    GPIO.output(7, GPIO.HIGH)
    GPIO.output(7, GPIO.LOW)

Make sure you change it in both locations/

Blink at different rates

To make the LED stay on for a different amount of time than it stays off change the values in sleep to differnent values.

A quick blink, can look like this:

while True:
    GPIO.output(7, GPIO.HIGH)
    GPIO.output(7, GPIO.LOW)

It will blink for one tenth of a second then stay off for a full second.

When working with electronics this approach can be used to signal different states.

Experiment with different values to see what you can come up with.

Posted on Leave a comment

RaspberryPi – 16×02 LCD Display in Python

If you want details from the source, the library we are using here is fully documented at

The Fritzing Diagram can be helpful in wiring up the Pi and the LCD, Fristzing contain pin identifications if you hover over the pin.

The Bare Minimum to get a message on Screen

Wire the Components

The Wiring for the Python version of code is the same as the NodeRED version. Follow the wiring section on that post and return here for the code.

Get The Library

$ sudo pip install RPLCD

Coding Python

The beauty of coding for hardware like an LCD on the Raspberry Pi is that the code is already present where it will be executing. There is no need to compile and upload for a Python Script.

If you prefer to code on your desktop it as simple as copying the resulting Python file to your Raspberry Pi.

For this activity we will be coding in the bash shell via an ssh connection.

ssh pi@

Define the pins that will be used

We will use simple variables to define each of the pins connecting the LCD to the Pi. They could be more abbreviated but to help with clarity we will use longer names.

DATA_PIN_D7 = 26
DATA_PIN_D6 = 24
DATA_PIN_D5 = 21
DATA_PIN_D4 = 19

Let’s create any LCD Object using the VAriables we setup above. The RPLCD library does all the hard work all we need to do is import the library and then create an “instance”.

First import the Library

from RPLCD.gpio import CharLCD

Now using the variables we set up earlier we will create the LCD object. The CharLCD class uses keyword args for input. So each argument is a keyword and the value being assigned.

my_lcd = CharLCD(cols=16, rows=2, pin_rs=REGISTER_SELECT, pin_e=ENABLE, pins_data=[DATA_PIN_D7,DATA_PIN_D6,DATA_PIN_D5,DATA_PIN_D4]

That’s all we need, add a line with what text you want to display and you are good to go.

my_lcd.write(u'Message of Hope')

Posted on Leave a comment

RaspberryPi – 16×02 LCD Display on NodeRED


  • Raspberry Pi 3
  • 16×2 LCD
  • Breadboard
  • Hookup Wire
  • Trimmer / Potentiometer

Use the Pallete manager to install node-red-contrib-lcd


Add the LCD Node to your flow.

The LCD node requires a string indiacting whcih pins of the LCD are connected to which pins of the pi. The format is shown when you double click the node to configure it.

The “Pins, Type” field will give you the format \: RS, EN, D7, D6, D5, D4, ROW, COL

The pin numbering using Board numbering is 6,5,10,9,8,7,2,16

Add the pin numbering and click done.

Board Numbering: 6,5,10,9,8,7,2,16

GPIO Numbering : 31,29, 26,24,21,19, 2,16

Board numbering is simply sequential with even numbers from 2 on the outer row and odd numbers from 1 on the inner row.

Add an inject node:

Connect the inject node to the LCD node.

Double click the inject node and add a string to,

That’s all there is on the NodeRED end, you can deploy now or wait until after wiring.

If you don’t want to wire up the Flow you can just copy in this:


The Full Fritzing Diagram is on

Let’s wire up our Pi and LCD as follows. Some color coding can help but the colors are not important.

Connect a Wire from “PIN 2” on the RaspberryPI to the Lower rail ( Red ) on your breadboard. This is +5volts and will be used to power the LCD and the LCD Backlight

Connect a second wire from PIN 6 to the Blue Rail on the Breadboard, this will provide the GRound or NEG for the LCD.

Connect the DATA Lines

We can connect the four Data lines from the LCD to any GPIO Pins on the RaspberryPi. In this example, GPIO 7,8,9,10 were selected for visual location and consecutive numbering. As shown we will be using Blue and White wires for the DATA lines but any color can be used.

Connect GPIO10 to the Breadboard directly below the LCD Pin As Shown. It will be the third pin from the left and likely labelled D8, Pin 14 or sometimes DB7.

Connect GPIO 9 to D7 ( DB6 )

Connect GPIO 8 to D6 ( DB5 )

Connect GPIO 7 to D6 ( DB5 )

Connect the Control Lines

There are only two lines that will be used to control the LCD. Enable and Command Mode. The enable line is basically the on/off switch for the LCD connected to the PI and the Command Mode or “Register Select” informs the LCD if it will be receiving a command to act upon or letters to display.

Connect GPIO5 to the Breadboard colum directly beneath the E pin on the LCD.

Connect GPIO6 to the Breadboard colum directly beneath the RS Pin on the LCD

Wire the Contrast Knob

Trimmer/PotentiometerPotentiometer ) to the LCD VO ( Contrast ). Make sure you coonect the “Wiper” the cneter in this case to the column directly beneath the VO

Connect the Dimmer s( Trimmer/Potentiometer ) legs CW and CCW to +5v and Ground, the polarity of these two determine whether the contrast is increased with a Clockwise turn or a Counter-Clockwise turn.

Deploy the Node and Try a Message

Posted on Leave a comment

Linux Server System Auditing – Quick Start

I wanted a tool to quickly show me some of the basic things I needed to work on to harden the security on the various servers I am running. A sort of security checklist. The first tool I have been trying out is the community version of Lynis, and I have enjoyed it so far. With a “Hardeining index” from 1-100, it gives me a great indicator of how I am progressing.

Once installed ( and they have detailed install instructions for many systems ) it is as easy as a single command to get you started:

lynis audit system

you will get a giant ( not too giant ) list of the status of your system and actionable items.

For my scan I fixed a few things moving from 66 to 72 in my first hardening session.