Make a TCP connection from Bluetooth.
SSH into a Linux machine, which is headless (e.g. Raspberry Pi Zero 2 W) or has a bad network configuration, without using a Display Monitor.
When you have network connection:
- Run
make deviceto build the binary for device. - Put the binary into
/usr/local/bin. - See Service below to make it auto start upon boot.
-
Run
make host -
Create a SSH config in
~/.ssh/config:Host zero ProxyCommand bletun
-
ssh zeroand wait patiently, it will discover the first available device.
Note: Only one SSH connection is allowed at a time, which is a characteristic of Bluetooth connections. If you want multiple shells, use tmux.
Packages:
- dbus
- bluez
File: /etc/systemd/system/bletun.service:
[Unit]
Description=bletun
# On Ubuntu, it changed? first it's sshd, it's now ssh.
#Requires=sshd.service
#After=sshd.service
[Service]
ExecStart=/usr/local/bin/bletun
Restart=on-failure
[Install]
WantedBy=multi-user.targetEnable:
$ sudo systemctl daemon-reload
$ sudo systemctl enable bletun.serviceFile: /etc/init.d/bletun:
/etc/init.d/bletun
#!/sbin/openrc-run
name="bletun"
command="/usr/local/bin/bletun"
pidfile="/run/bletun.pid"
command_background=true
supervisor=supervise-daemon
respawn_delay=5
respawn_max=0
depend() {
need dbus bluetooth
}Enable:
$ chmod +x /etc/init.d/bletun
$ rc-update add bletun default
$ service bletun restartThere's no Bluetooth Paring. Anyone can connect to the same device. Authentication is done by SSH.
- Flow Control: Sending is too fast, while Recv is too slow.
- Allow more than one client.