2

I am trying to access iOS files from gnome-terminal. This is a re-incarnation of this question, because the answer no longer works for recent iOS and recent Ubuntu. I have also tried this solution to no avail.

I am running Ubuntu 19.10 with an iPhone 8.

I can see the files in nautilus with a path of afc://3bea74ae860d493803664babbaeac93614091e43/ but I cannot cd to the path in the terminal.

I have already installed ifuse but mounting manually and accessing just results in IO errors.

How can I access my iOS files from the Terminal?

2 Answers 2

3

Run this in the terminal:

cd /run/user/1000/gvfs/afc:host=3bea74ae860d493803664babbaeac93614091e43

For others, if you check this directory, you'll find your apple device, if it's mounted:

cd /run/user/1000/gvfs/afc\:host\=????????????????????????????????????????
1
  • Make sure you have these installed:
    – Gruzzles
    Commented Jan 9, 2021 at 19:35
2

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

  1. Run sudo apt install libimobiledevice6 libimobiledevice-utils
  2. Run idevicepair pair
  3. Run usbmuxd -f -v
  4. Run sudo apt install ifuse
  5. Make sure that idevicepair pair worked: you will need to unlock the iPhone and say yes to the Trust dialog
  6. Run sudo mkdir /mnt/iphone
  7. Run sudo su
  8. 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:

  1. 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
  2. Run sudo vim /etc/ssh/sshd_config or sudo nano /etc/ssh/sshd_config (if you like nano)
  3. Change text to #PubkeyAuthentication no or PubkeyAuthentication no
  4. Change text to #PasswordAuthentication no or PasswordAuthentication no
  5. 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
  1. Save the text file
  2. Run sudo systemctl restart sshd.service
  3. Install FTPManager from https://apps.apple.com/us/app/ftpmanager-ftp-sftp-client/id525959186
  4. Connect FTPManager to your computer's local IP address
  5. 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}'
  6. 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.
  7. 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.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .