I am searching for a convenient way to securely transfer a single file from a desktop computer A to a mobile computer B. A runs Linux, B runs Android. By "securely" I mean that:

a) a file must not leak to a third party and

b) A and B do not trust each other. I specifically ask how to transfer a single file.

c) It should be as easy as picking that file in a file manager

Update 2016-11-24

I expect non-regular transfers, in other words, a transfer is usually the first transfer between A and B, and they were not configured for this transfer before. A and B are connected to the internet. (Well, what is not connected to the internet nowadays?) But:

d) at least one computer has no global IP address or

e) both have no global IP address.

Consider the cases (d) and (e) separately.

Some schemes I can think of.

  1. B is connected as a MTP storage. Then even the internal flash memory of B is accessible. Contradicts (b).
  2. Wired or wireless Ethernet requires configuring a network, then a network server of some sort (for example, FTP, HTTP), then an authentication scheme. This scheme is bad on (c).
  3. In principle, a connection via a cable or an optical link does not require authentication because I see what device A or B is connected to. So it fits (c) better than a wireless connection. But I don't know how to exploit a cable without Ethernet or what program can transfer a file via an optical link.
  4. Moving a flash memory device between A and B. Wiping the whole partition containing the file by the Unix program "shred" satisfies (a). Low on (c).
  • Would you be okay with a program that served the file over LAN?
    – zondo
    Nov 24, 2016 at 4:30
  • @zondo: It depends on security and setup costs of your solution. I expect non-regular transfers, in other words, a transfer is usually the first transfer between A and B. (I did not mention it in the question, sorry. Fixed.) A and B are connected to the internet. (Well, what is not connected to the internet nowadays?) But d) at least one computer or e) both has no global IP address. Consider cases (d) and (e) separately.
    – beroal
    Nov 24, 2016 at 9:04
  • 1
    I don't get that this is a software recommendation question...
    – user416
    Nov 24, 2016 at 9:52
  • @Jan Doggen: Actually, I agree in that the question is between software and security, but I am not allowed to cross-post. 😉
    – beroal
    Nov 24, 2016 at 10:06
  • 2
    Delete it here and place it on security.stackexchange.com? I think you have a much better chance of getting answers there. Take care to reformat/rewrite your question, these c) d) e) make it hard to read.
    – user416
    Nov 24, 2016 at 10:17

3 Answers 3


You could use, for small text files, convert to QR Code, e.g. using the python QR Code library & command line, on the laptop screen and scan it in with one of the many Android clients on the phone such as QR Droid.

Note that QR codes can also be used to input WiFi connection details so you could use a script to create a temporary WiFi connection with a random pass code and generate the QR code for that connection - this would eliminate the setup time. The same script could possibly set an FTP (e.g.: twistd -n ftp) to allow up and downloads or Web Server (e.g.: python -m SimpleHTTPServer) downloads only running with access to a specified directory only. This could also output a QR Code to be scanned to get to the correct location.

All of the code mentioned in this answer with the exception of QR Driod is:

  • Free, Gratis & Open Source
  • Cross Platform including Windows, OS-X & Linux
  • Likely to already installed on your Linux system or simple to install with pip
  • Is there a way to run those HTTP and FTP servers such that they offer encrypted and authenticated connections? (I guess that a connection password can be transferred via QR Code.) Otherwise it is not acceptable.
    – beroal
    Dec 3, 2016 at 18:07
  • I am feeling that software recommendations gradually slide to software creation. This is what I was afraid of. ☹
    – beroal
    Dec 3, 2016 at 18:09
  • @beroal - it is possible to set up server with authentication - it takes a bit more than a single line though. The more specific and unusual your requirements the more you need to customise software otherwise you have to work the way that someone at a big company decided for you. Dec 4, 2016 at 12:47

A Possibility includes:

  • Blu-tooth file transfer which has minimal user authentication & setup and allows one-to-one communication only.

Bluetooth authentication usually consists of one device prompting for a PIN that is randomly generated by and displayed on the other device. You can pair devices to allow connections to be re-established when the 2 devices are within range of each other without going through this step and some devices, e.g. headphones, skip this step or have a fixed PIN. Once communication is set up you can, usually sometimes optionally, specify shared folder(s) to allow the other device to down/up load content using a file explorer type interface.

  • What do you mean by "minimal authentication"? That Bluetooth provides weak authentication? Then it definitely is not acceptable.
    – beroal
    Nov 24, 2016 at 8:54
  • A QR code transfer seems feasible. I suggest you to place your solutions in 2 answers because they are quite different.
    – beroal
    Nov 24, 2016 at 9:12

This is a non-trivial problem, not really suitable for Softwarerecs.SE IMO.

Still, here goes. (With any luck, if the question gets migrated to Security.SE, this answer will be migrated along with it.)

There are various potential solutions available at widely differing costs of implementation.

First of all, the end-points would need to be secured against any attacks that might reveal what was being transferred. TEMPEST attacks, for instance.

If you use ranged (e.g. wireless or optical) communications, then there is a risk of eavesdropping unless the two computers are in a container (e.g. a Faraday cage, or a light-proof box or room, respectively) impervious to the signals involved.

If you use wired communications, you would need to be sure that the communication medium was immune to TEMPEST-style attacks. Special USB and Ethernet cables, etc. are available for a high price that supposedly meet this requirement. (Or, again, maybe you could build or buy a suitable room or box.) But you also ought to consider the risk of A or B compromising the other over the connection, e.g. via attempting to exploit the network stack. So, the simpler the protocol the better, to minimise the TCB. Something like serial (maybe via the JTAG port on B?) could be your best bet on this front.

Finally, if you use removable media, then you should consider how to avoid malware being transferred from A to B. This could happen via controller chips (e.g. BadUSB) if present, or through other exploits further up the stack.

One reasonably secure option would be to:

  • use a removable medium that is free of controller firmware, e.g. a floppy disk, or a ZIP disk (I think these are firmware-free), or a CD-R or DVD+/-R or BD-R; and
  • have a pair of drives for that medium, one attached to A and one attached to B, so as to avoid e.g. BadUSB being transferred from A to B; and
  • sign the file on A before writing it to the removable medium, and verify the signature on B after reading it from the removable medium (e.g. using GnuPG or one of its front-ends to generate and verify signatures); and
  • carry this out in as TEMPEST-proof an environment as you can arrange.
  • "If you use ranged (e.g. wireless or optical) communications, then there is a risk of eavesdropping unless the two computers are in a container" There is a cheaper solution. Integrity gives confidentiality by the Diffie-Hellman algorithm, hence it is enough to have integrity in order to protect ourselves from eavesdropping. TEMPEST is not an attack on transfer, so it is not appropriate to touch it in this question.
    – beroal
    Mar 2, 2018 at 10:53
  • @beroal, but the hosts are not trusted. So, fitting either of them with a mechanism for ranged communication (e.g. an IrDA or WiFi transceiver) would allow them to open a ranged side channel. The only obvious way to block that would be to attenuate the side channel signal somehow, hence my suggestion.
    – user2545
    Mar 2, 2018 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.