Reputation: 19505
Is there a way to pair a device in linux without requiring a pin(for testing purposes so I need it to be done w/out human interaction, assuming you have root access)?
bluez-simple-agent seems to require a pin except with some simple devices such as mice.
Upvotes: 44
Views: 151397
Reputation: 69
The following command works for me in debian system:
yes | bt-agent --capability=NoInputNoOutput
The command bt-agent --capability=NoInputNoOutput
might request to input yes/no when an external device tries to pair with your device and this yes |
part helps in always inputing yes which helps in pairing both devices.
Prerequisite: Install bluez-tools via:
sudo apt install bluez-tools
Upvotes: 1
Reputation: 11
~ $ hciconfig noauth
It worked for me in "Linux mx 4.19"
The exact steps are:
1) open a terminal - run: "hciconfig noauth"
2) use the blueman-manager gui to pair the device (in my case it was a keyboard)
3) from the blueman-manager choose "connect to HID"
step(3) is normally asking for a password - the "hciconfig noauth" makes step(3) passwordless
Upvotes: 0
Reputation: 271
follow steps (CentOs):
If you want more details https://www.youtube.com/watch?v=CB1E4Ir3AV4
Upvotes: 27
Reputation: 31
~ $ hciconfig noauth
This should do the trick (I'm using bluez 5.23 and there's no more simple-egent and blue-utils). However, I'm trying to look for a way to make changes hciconfig permanent because after power out and then power on, authentication is needed again. So far, the changes in hciconfig still stays the same when you reboot it. it reverts back only when power out. If anybody has found a way to make hciconfig permanent, do let me know!
Upvotes: 2
Reputation: 2965
This worked like a charm for me, of-course it requires super-user privileges :-)
# hcitool cc <target-bdaddr>; hcitool auth <target-bdaddr>
To get <target-bdaddr>
you may issue below command:
$ hcitool scan
Note: Exclude #
& $
as they are command line prompts.
Upvotes: 10
Reputation: 7667
For Ubuntu 14.04 and Android try:
hcitool scan #get hardware address
sudo bluetooth-agent PIN HARDWARE-ADDRESS
PIN dialog pops up on Android device. Enter same PIN.
Note: sudo apt-get install bluez-utils
might be necessary.
Note2: If PIN dialog does not appear, try pairing from Android first (will fail because of wrong PIN). Then try again as described above.
Upvotes: 7
Reputation: 527
Entering a PIN is actually an outdated method of pairing, now called Legacy Pairing. Secure Simple Pairing Mode is available in Bluetooth v2.1 and later, which comprises most modern Bluetooth devices. SSPMode authentication is handled by the Bluetooth protocol stack and thus works without user interaction.
Here is how one might go about connecting to a device:
# hciconfig hci0 sspmode 1
# hciconfig hci0 sspmode
hci0: Type: BR/EDR Bus: USB
BD Address: AA:BB:CC:DD:EE:FF ACL MTU: 1021:8 SCO MTU: 64:1
Simple Pairing mode: Enabled
# hciconfig hci0 piscan
# sdptool add SP
# hcitool scan
00:11:22:33:44:55 My_Device
# rfcomm connect /dev/rfcomm0 00:11:22:33:44:55 1 &
Connected /dev/rfcomm0 to 00:11:22:33:44:55 on channel 1
Press CTRL-C for hangup
This would establish a serial connection to the device.
Upvotes: 35
Reputation: 3172
Try setting security to none in /etc/bluetooth/hcid.conf
http://linux.die.net/man/5/hcid.conf
This will probably only work for HCI devices (mouse, keyboard, spaceball, etc.). If you have a different kind of device, there's probably a different but similar setting to change.
Upvotes: 11