title: rfcomm bluetooth permission denied error raspberry pi
body: <p>I'm using a bluetooth dongle to try and send information from ubuntu 15.04 to raspberry pi b+ running the latest debian jessie image. I'm just following the <a href="http://people.csail.mit.edu/albert/bluez-intro/" rel="noreferrer">http://people.csail.mit.edu/albert/bluez-intro/</a> tutorial. I got the simple RFCOMM and L2CAP protocols working. I'm having trouble running the SDP protocol. The server code is - </p>
  
  <pre><code>from bluetooth import *
  
  server_sock = BluetoothSocket(RFCOMM)
  server_sock.bind(("", PORT_ANY))
  server_sock.listen(1)
  
  advertise_service(server_sock, "SampleServer",service_classes=[SERIAL_PORT_CLASS], profiles=[SERIAL_PORT_PROFILE])
  
  client_sock, client_info = server_sock.accept()
  
  print "connection from: ", client_info
  
  client_sock.send("PyBluez server says Hello!")
  data = client_sock.recv(1024)
  print "received: ", data
  
  client_sock.close()
  server_sock.close()
  </code></pre>
  
  <p>The error I'm getting is -</p>
  
  <pre><code>Traceback (most recent call last):
    File "rfcomm-server.py", line 7, in &lt;module&gt;
      advertise_service(server_sock, "SampleServer",service_classes=[SERIAL_PORT_CLASS], profiles=[SERIAL_PORT_PROFILE])
    File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 176, in advertise_service
      raise BluetoothError (str (e))
  bluetooth.btcommon.BluetoothError: (13, 'Permission denied')
  </code></pre>
  
  <p>Here are some steps I have taken-</p>
  
  <pre><code>Add the user 'pi' to lp group
  run piscan on hciconfig hci0
  Add --compat option to bluetoothd in bluetooth.service
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>