SSH Over Bluetooth (2/3rds Complete)

Background Information

In this situation, the intention is to create an SSH connection between an RPI (linux) system and an OSX system. For this specific case I am using a Bluetooth 4.0 usb dongle found on Amazon for $15.

For OSX; goto System Settings – Bluetooth. Make sure bluetooth is turned on, and that it is in discoverable mode.

Step 1; Method One: hcitool

Using hcitool, will force a bluetooth pair on the clients machine from the RPI.

Step One - Find client Bluetooth Address
1
2
3
4
$ hcitool scan
Scanning ...
    5X:XX:XX:XX:XX:XA mbr
note: (address obscured)
Step Two - Force client pair Bluetooth Address
1
2
3
$ hcitool cc 5X:XX:XX:XX:XX:XA
$ hcitool auth 5X:XX:XX:XX:XX:XA
note: commands must be quickly executed, within less than 2 seconds.

If the two commands are executed in quick succession, it will force a bluetooth pairing request on the client’s computer.

Checking the OSX client computer, accept the bluetooth pairing request. The pairing code does not matter (it will not appear on the linux command line). Just hit accept.

After accepting the pair request, the profile is saved, and connected.

Step 1; Method Two: hciconfig

Using hciconfig, will make the RPI discoverable for all clients to then pair with.

Force RPI to become discoverable
1
$ sudo hciconfig hci0 up && sudo hciconfig hci0 piscan

Now follow the OSX pairing procedure.

Step 2; Configure Linux for serial over bluetooth

Backup rfcomm.conf:

1
$ cp /etc/bluetooth/rfcomm.conf /etc/bluetooth/rfcomm.bak

Edit rfcomm by opening nano with admin privileges:

1
$ sudo nano /etc/bluetooth/rfcomm.conf

Replace contents of rfcomm with the following:

Edit rfcomm with:
1
2
3
4
5
6
7
8
9
10
11
12
# RFCOMM configuration file.
      #
      rfcomm0 {
         bind yes;
        # Bluetooth address of the device
        # Change xx:xx:... to your device's mac addr
       device xx:xx:xx:xx:xx:xx;
        # RFCOMM channel for the connection
        channel 1;  # SerialPort Channel
        # Description of the connection
        comment "Gumstix Bluetooth Serial Console";
      }

Source

To confirm that your bluetooth device runs the SerialPort service over channel 1:L

Verify available bluetooth services, by channel:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ sdptool browse
  .
  .
  Service Name: SerialPort      # <--- Confirm
  Service RecHandle: 0x10009
  Service Class ID List:
    "Serial Port" (0x1101)
  Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
      Channel: 1                # <--- Confirm
  Language Base Attr List:
    code_ISO639: 0x656e
    encoding:    0x6a
    base_offset: 0x100
  Profile Descriptor List:
    "Serial Port" (0x1101)
      Version: 0x0100
    .
    .

Install Kermit:

1
$ sudo apt-get install ckermit

Reboot (important)

Bind rfcomm connection:

1
2
$ sudo rfcomm bind 1 xx:xx:xx:xx:xx:xx # Linux bluetooth address
note: $ hcitool dev -> Will yield linux bluetooth address

Initiate Connection

Start rfcomm connection:

1
$ kermit -l /dev/rfcomm1