One of the multiple useful features from KDE Connect is browsing your phone files on your desktop. However, that’s currently only available through the GUI, e.g., in KDE Connect tray icon or Dolphin’s side panel. KDE Connect does have a command-line tool (
kdeconnect-cli), but it lacks that option.
So if, for any reason, you need to do that mounting programatically, this guide should help you.
Getting what we need
First of all, let’s gather the information we need. Mount the filesystem clicking KDE Connect’s tray icon and selecting Browse device. Now run
mount | grep kdeconnect, and you should get this:
kdeconnect@PHONE_IP:/ on /run/user/UID/PHONE_ID type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=UID,group_id=GID)
This shows us that KDE Connect mounts the exposed filesystem through SFTP, connecting to a SSH server on our phone as the user
So now we should find to which port it connects on our phone. With
netstat, I found it to be the port 1740. Please check if your port is the same.
Finally, we should find KDE Connect private key to attempt the connection. This should be at
Mounting the filesystem
With all that information, let’s now try to mount our phone filesystem with
~/mnt with whatever mount-point you want, and
PHONE_IP to your actual phone IP, and issue:
sshfs -o rw,nosuid,nodev,identityfile=$HOME/.config/kdeconnect/privateKey.pem,port=1740 email@example.com:/ ~/mnt
If it went well, you’re done. Now you can use that command to easily mount your phone filesystem via CLI.