I am running Raspbian with BlueZ 5.30 and a Cambridge Silicon Bluetooth USB Dongle installed. I can successfully bring up the BLE interface, as well as detect and connect to a TI SensorTag over BLE when logged in as "pi" and using sudo in front of every bluetooth command (such as hciconfig, hcitool, gatttool, ...)
Is there a way to set things up (file permissions, group memberships, etc.) so that a regular (non root, student) user can connect the the SensorTag (and other BLE peripherals) without having to use sudo all the time?
Re: How to connect to Bluetooth LE devices without being roo
Gatttool works for the pi user without changes (too many 'tutorials' just put 'sudo' in front of everything). But bluetoothctl needs some work. Create a D-Bus security policy for the pi user. and add the following policy: before the closing '</busconfig>' tag. Alternately, create a 'student' group and a <policy group="student">...</policy>
bluetoothctl should give you everything you need to manage the local and remote devices.
Code: Select all
sudo nano /etc/dbus-1/system.d/bluetooth.conf
Code: Select all
<policy user="pi">
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
</policy>
bluetoothctl should give you everything you need to manage the local and remote devices.