6

How do you configure Ubuntu Server to automatically receive files over Bluetooth and save them with no user interaction?

This question is almost identical to this question from 2 years ago, but relates to Ubuntu Server, where no GUI is available.

Edit: To clarify, this question is not about pairing Bluetooth devices, but about making an Ubuntu Server machine automatically accept Bluetooth file transfers. This question is not a duplicate.

James
  • 171

2 Answers2

1

A quick look in dconf-editor and...

gsettings set org.gnome.desktop.file-sharing bluetooth-obexpush-enabled VALUE

Is the equivalent to 'Receive files in Downloads folder over Bluetooth', VALUE can be true or false

gsettings set org.gnome.desktop.file-sharing bluetooth-obexpush-enabled VALUE

Is the same as 'Notify about received files', VALUE of true or false again.

gsettings set org.gnome.desktop.file-sharing bluetooth-accept-files

is the same as the 'Accept files:' selection box, VALUE can be always, bonded (Only work for set-up devices) and ask.

Here is the picture from the other question in case you need it.

You can find what the current values are using get in place of set, To reset, use reset instead.

To list the available options:

$ gsettings list-keys org.gnome.desktop.file-sharing
bluetooth-accept-files
bluetooth-allow-write
bluetooth-enabled
bluetooth-notify
bluetooth-obexpush-enabled
bluetooth-require-pairing
enabled
require-password

Here also is a list with possible values in bold

org.gnome.desktop.file-sharing bluetooth-accept-files always bonded ask
org.gnome.desktop.file-sharing bluetooth-allow-write true false
org.gnome.desktop.file-sharing bluetooth-enabled true false
org.gnome.desktop.file-sharing bluetooth-notify true false
org.gnome.desktop.file-sharing bluetooth-obexpush-enabled true false
org.gnome.desktop.file-sharing bluetooth-require-pairing true false
org.gnome.desktop.file-sharing enabled true false
org.gnome.desktop.file-sharing require-password never on_write always

More can be found using man gsettings

Hope this helps ;D - Not as though I am doing this just because I use a netbook with a broken display for file sharing, for which this could be rather helpful...


As the above answer will probably only work if you have a graphical Gnome-based desktop installed, a simpler thing may be to use bluez as in the answer here.

Wilf
  • 30,194
  • 17
  • 108
  • 164
  • 1
    org.gnome.desktop? I don't have Gnome installed since this is a server; will the Bluetooth system read the configuration from there regardless? I can't test it at the moment. – James Jan 20 '14 at 23:04
  • I have tested this and it seems to work - I do have Gnome installed, though this in Unity... Unity is a derivative of Gnome, so they seem to share the same settings. – Wilf Jan 20 '14 at 23:12
  • While your answer is probably helpful to some, I just checked, and my server doesn't even have dconf installed, so I don't think this will work. – James Jan 20 '14 at 23:22
  • No you don't need it installed, it is just the graphical interface for gsettings, I linked it as then you can use it on an Ubuntu which has a graphical interface if you want. It works without Gnome, on the netbook I referred to in my answer, but you do need to be logged in. By the way, you may be interested in this answer in another question. – Wilf Jan 21 '14 at 19:22
  • I went ahead and installed libglib2.0-bin which provides the gsettings executable. Unfortunately, running gsettings list-schemas reveals that there is no org.gnome.desktop.file-sharing schema. Should I create the schema and populate it with the default values manually? – James Jan 22 '14 at 22:34
  • You could install the Unity or Gnome desktops, which would probably add it... But that may be uncessary - you can check with gsettings list-schemas | grep file-sharing – Wilf Jan 23 '14 at 11:30
  • That returns no results. There is no file-sharing schema. – James Jan 23 '14 at 19:11
  • I did add an edit to the bottom of my answer that may be of help... – Wilf Jan 23 '14 at 19:14
  • The question you linked doesn't mention anything about file transfers at all, only pairing. – James Jan 24 '14 at 22:06
  • http://askubuntu.com/a/41050/178596 ? Receiving file transfers generally seems to automatically be sent to a particular folder. If not you can use obexpushd, which will run a deamon to receive files - http://debaira.blogspot.co.uk/2007/10/bluetooth-command-line.html . These can all be installed easily using sudo apt-get install.... – Wilf Jan 24 '14 at 22:33
  • 1
    Thanks wilf, I found obexpushd a few hours ago and it seems to be working fine; just finished writing an upstart job for it. I came back here to write up a quick answer for it, but if you want credit for it, go ahead and submit something, and I'll mark it as accepted. – James Jan 24 '14 at 23:35
  • It be best for you to do an answer, as I can't test it as the only Linux machine I have with functioning bluetooth is the aforementioned Netbook, which is running an old Fedora release, not Ubuntu. You also then get credit for it ;-) – Wilf Jan 25 '14 at 21:51
1

A good solution that @wilf and I found was to install obexpushd, a daemon that will accept incoming OBEX (and therefore Bluetooth) file transfers and save the files to its working directory.

Just apt-get install obexpushd, and run it in the directory you want the files to be saved in. Or, if you'd like it to start with your machine, here's a simple Upstart job file that should do the trick:

chdir /home/USERNAME
exec obexpushd -n
start on startup

Save the above as /etc/init/obexpushd.conf (making sure to change the first line to point to the directory you'd like the files to be saved), run initctl reload-configuration, and start obexpushd.

Once you've paired your Bluetooth device with your machine, you should be able to send files to it without having to manually accept the transfer.

James
  • 171