2021 Transfer files from Linux PC to iPhone

In 2021, it is surprisingly painful to transfer files from a Linux x86_64 PC to an iPhone running iOS 14.x. In this post, RTWM Research Group outlines one method for file transfer.
In this how-to article we outline one method that works for us.

Please note that USB file transfer with wire is our preferred method for local transfer. (no network required)

However, it seems damn near impossible in 2021 to use USB wire transfer, with the current state of iOS restricted security, sand-boxing, etc. etc.

We welcome feedback or comments regarding any easy methods that we have not discovered, or are simply unaware of.

Please send feedback to email hello at subject: "Linux-iPhone file transfer".

Step 1 - Prepare Linux PC computer

If you do not already have devd installed, now is the right time to install it. devd can create an on-demand local web server, in whichever directory it happens to be executed from.

Combined with the right switches when devd is started, you will get a “restricted” web server, serving files on your local network. But the files being served are only inside the directory where you need them served temporarily for a few minutes.

brew install devd

or alternatively, install from a release found here:

Step 2

Open a terminal, and change to the directory with files that you want to transfer to the iPhone.

cd /path/to/some/files/

Step 3 - Run devd web server locally on demand

Run devd with the right switches, so that it runs on all local network interfaces on your Linux PC.
Below, is the best way to run devd for file transfer to iPhone (or some other local network device)

devd -wl -a .

The -a switch is very important, it says to listen on all local interfaces.
The dot . is also very important, it tells devd, to serve files from this directory only.

Step 4 - Configure PC firewall to accept incoming requests on devd TCP port

This step can be done with GUI tool, or with command line.

The port to configure depends on which port devd is using. Note that devd will often, but not always run on TCP port 8000.

sudo ufw allow tcp/8000

Step 5 - Open Web Browser on iPhone, or another application that can do network downloads to local storage on the iPhone.

  • Determine what your Linux PC IPv4 / IPv6 address is on your local network.
ifconfig -a | less
  • Test connection with Browser. Open up Web Browser application on iPhone. In our situation, we use DuckDuckGo Browser or Firefox browser, to test the devd web server on the PC.
# Example:

# Real:

  • You should see a listing of the files in your local directory where you started devd

Step 5.1 - Begin actual file transfer / upload/download

In our example , we are going to transfer some large audio files directly to the internal storage of the iPhone without using Internet upload to datacenter + download back to iPhone. We want to avoid unnecessary transfers, and delay. (We would prefer to do this with USB transfer anyway.)

We are going to use on the iPhone for this process. Note that it could be done from web browser too, however, then it is highly possible that the files, audio in our situation, would be sandboxed within the browser file storage. Thus, difficult or impossible to move into a storage place where an audio optimized player application, such as VLC or similar can open the audio files.

Step 5.2 - Install or open VLC app on iPhone:

  • Tap on the “Network” tab on the button.
  • Tap on the “Downloads” option.
  • Copy from iPhone web browser, the full URL of the file by tapping and holding on the blue URL for the file.

In our example, it will look similar to this below:

cd /path/to/some/files
ls -la

total 32K
drwxrwxr-x 2 rtwm rtwm 4.0K May 23 10:44 audio
-rwxrwxr-x 1 rtwm rtwm 1.3K May 23 10:00
-rwxrwxr-x 1 rtwm rtwm  501 May 23 00:09

cd audio
pwd /path/to/some/files/audio

devd -wl -a .

Step 5.3 - Paste in the full URL into download address bar.

  • Repeat this copy/paste process for each file you need to download.
    The files will start a queue, and download sequentially, one after the other.

  • You will start to see the files show up in the audio tab.

  • PLEASE NOTE - If you have large files to transfer, it is best to have iPhone or iPad plugged into power source.

  • HIGHLY SUGGESTED - Configure iPhone or iPad display options so that screen “never turns off.” I have seen situations where if another application is opened, or the screen turns off, file download completely fails, and has to be started all over again.

  • OPTIONAL - If you want / need to organize the files in a better manner, open up the native iOS file browser, aptly named, “Files” application on the iPhone.

  • Tap on VLC icon, and create a new directory inside, and move the files to a new directory within the VLC storage sandbox. You may have success moving the files outside of the VLC storage sandbox.

(Your mileage here may vary depending on the version of iOS you are running and various iOS / iPadOS security policies in place at any given moment.)

Final Summary

With devd server and a web browser or download application such as VLC, you can transfer files to your iPhone from a Linux PC in 2021. The process seems extremely painful compared to file transfer from Android based mobile OS. But still possible!

#life-of-technology - #hacker-quarterly