The way I see it, there are three types of iOS/iPhone files:
gphoto2://
files: these can easily be accessed (by a GUI file manager and probably also a terminal program); they are image/video files in the "DCIM" folder. (If you are having trouble accessing these files, consider restarting usbmuxd via sudo systemctl restart usbmuxd
)
afc://
files: I have researched this for hours and have not found a way to really access them via a terminal program. However, you can still transfer them from your iPhone to your Linux machine over your local network. See below for the method (which should transfer the files over the local network, not the Internet).
- Files which are neither
gphoto2://
nor afc://
files: these files can be accessed by correctly mounting the iPhone via ifuse.
Access files which seem to be neither gphoto2://
nor afc://
files
- Run
sudo apt install libimobiledevice6 libimobiledevice-utils
- Run
idevicepair pair
- Run
usbmuxd -f -v
- Run
sudo apt install ifuse
- Make sure that
idevicepair pair
worked: you will need to unlock the iPhone and say yes to the Trust dialog
- Run
sudo mkdir /mnt/iphone
- Run
sudo su
- Run
ifuse /mnt/iphone
You will be able to see basically hidden files, like those in "/mnt/iphone/PhotoData/Thumbnails/V2/DCIM" (if you took pictures or recorded videos with your iPhone). Oddly, the mount point folder (e.g. "iphone") might be perceived as "inode/x-corrupted-type" by PCManFM 1.3.1.
Access afc://
files via an iPhone app and SSH
This list is based on a section of https://medium.com/geekculture/the-iphone-to-linux-airdrop-alternative-you-need-804a082fec9e ("SSH") which worked for me:
- Run
sudo apt update -y && sudo apt install openssh-server -y && sudo systemctl enable --now ssh
if you don't already have those programs installed/running/enabled
- Run
sudo vim /etc/ssh/sshd_config
or sudo nano /etc/ssh/sshd_config
(if you like nano)
- Change text to
#PubkeyAuthentication no
or PubkeyAuthentication no
- Change text to
#PasswordAuthentication no
or PasswordAuthentication no
- Add this to the bottom of the plain text file:
# Allow from devices on most common WiFi ranges
Match Address 192.168.1.*
PasswordAuthentication yes
PubkeyAuthentication yes
Match Address 192.168.0.*
PasswordAuthentication yes
PubkeyAuthentication yes
# Allow from devices on iOS hotspot range
Match Address 172.20.10.*
PasswordAuthentication yes
PubkeyAuthentication yes
- Save the text file
- Run
sudo systemctl restart sshd.service
- Install FTPManager from https://apps.apple.com/us/app/ftpmanager-ftp-sftp-client/id525959186
- Connect FTPManager to your computer's local IP address
- See that IP address by running
ifconfig | grep -E "inet (192.168.[0-9].[0-9]+|172.20.10.[0-9]+) " | tail -1 | awk '{print $2}'
- Before copying or moving files from the iPhone to the Linux computer, set FTPManager to remember the SSH login. You should be able to copy
gphoto2://
files and afc://
files to your Linux machine.
- Transfer files. See https://www.skyjos.com/ftpmanager/help/help_main.php?section=file_transfer for how to transfer pictures, videos, or any other type of files.
I understand that this solution does not show how to access afc://
via a CLI, but it does address a problem presented in the OP: "mounting manually and accessing just results in IO errors."
You might need to have a jailbroken iPhone (I don't) to access afc://
via a CLI. From ifuse --help
:
--root mount root file system (jailbroken device required)
Example:
$ ifuse /media/iPhone --root
This mounts the root filesystem of the first attached device on
this computer in the directory /media/iPhone.
The above methods worked for me:
$ ideviceinfo
[...]
ProductName: iPhone OS
ProductType: iPhone8,1
ProductVersion: 15.5
ProductionSOC: true
ProtocolVersion: 2
[...]
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
(The answer of @Gruzzles was not really helpful, but it is a tiny bit helpful.)