HOW TO: Configure BeamOS to Access BeamTV Kodi Media Server

posted 28 Jul 2017, 13:35 by Mobile Onboard System Admin   [ updated 16 Aug 2017, 08:05 ]
NOTE: Familiarity with Linux scripting is required for this task.

This is an Advanced topic and support is only available to Beam Care subscribers.


If you are building a custom solution to run on the BW280 and require the BeamOS Controller Board to communicate with the BeamTV Kodi Media Board, it is necessary to create an SSH key on BeamOS and copy this over to the Kodi Media Server.  This will then allow them to authenticate and communicate with each other.

To create an SSH key between the BeamOS Controller and Kodi you will need to carry out the steps below.  The solution uses the Expect library, so that this can be done remotely without user interaction (headless installation).  Alternatively, you can disseminate the commands and execute manually within a shell:

1) SSH into BeamOS using the beam-admin username and password associated with the device

2) Add an additional routing configuration to allow access to the Kodi Board with the following command:

route add -net 192.168.101.0/24 gw 192.168.100.1

This needs to be added to the bottom of the file /etc/beam.os/beam-os-firewall.sh using nano so it will persist after a reboot.

3) Install the Expect library with

sudo apt-get install expect -y

4) Create a file with the following Expect script and copy to the BeamOS file system:

============================================
#!/usr/bin/expect -f

spawn ssh-keygen -t rsa
expect "Enter file in which to save the key (/root/.ssh/id_rsa): "
send "\r"
expect {
    "Overwrite (y/n)?" {
        send "y\r"
        expect "Enter passphrase (empty for no passphrase): "
        send "\r"
    }
    "Enter passphrase (empty for no passphrase): " {
        send "\r"
    }
}

expect "Enter same passphrase again: "
send "\r"
spawn ssh-copy-id osmc@192.168.101.254

expect {
    "Are you sure you want to continue connecting (yes/no)? " {
    send "yes\r"
    }
    "osmc@192.168.101.254's password: " {
        send "<PASSWORD>\r"
    }
}

expect "osmc@192.168.101.254's password: "
send "<PASSWORD>\r"

exec ssh osmc@192.168.101.254 "sudo chmod 777 -R /mnt/media"
==============================================


NOTE: The string <PASSWORD> in the above script is the actual BeamTV Admin password of your system, and has been redacted for security - please raise a support ticket if you would like us to advise you of this.

Running the above Expect script will handle a headless installation of an SSH Key generation to remove the need to enter a password for file transfers between the two units.