Notes on codes, projects and everything

HACK: Automount sshfs to my Jolla Phone in Ubuntu 14.04

I haven’t got much time lately, so didn’t write about this new phone that I recently imported. For some reason, this new phone of mine do not act as mass storage device like its predecessors (to certain extend). Thankfully I can still ssh in the phone and this makes it possible to mount it as a sshfs volume.

Warning: This WILL break your device

if you don’t know what you are doing.


Firstly we would need to enable developer mode on Jolla. I am not going to describe the steps, because if one doesn’t know this hack should not be applied. Next we need to know the network id and ip address of the phone, a simple ifconfig command should vomit all the needed information (connect the phone to the computer before doing ifconfig query). Assuming in this case the network id is usb1 and

Another note regarding the phone, for device running version earlier than, the usb network needs to be manually configured. However, in the recently released version, the phone is now a dhcp server so no need to fiddle with network manager settings anymore (yay!). I suppose most developers know this already though.

Ubuntu 14.04 (duh), but I suppose other versions would work fine too. Unfortunately I don’t have the time and resource to test this on other platforms. Next in the list is some packages that needs to be installed, as shown follows,

$ sudo apt-get install sshpass udevil sshfs


After installing the above packages, we then configure the udevil configuration. Use your favourite editor and edit /etc/udevil/udevil.conf

$ sudo vim /etc/udevil/udevil.conf

Make sure sshfs is included in allowed_types, eg.

allowed_types = $KNOWN_FILESYSTEMS, file, sshfs

Then check if ssh_command is allowed as an option

allowed_options_sshfs     = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, idmap=user, BatchMode=yes, port=*, ssh_command=*

Save the file, and we can now try to make sshpass work properly. The steps that I am about to show is very much adapted from this blog post by sperlyjinx. First, create a file to store the password to the Jolla phone.

$ cat > /path/to/.jolla_password <<EOF

(obviously change the path accordingly)

This file is used by sshpass to pass the password to ssh command. After this file is created, we need to create another shell script to run ssh command with sshpass utility.

$ sudo vim /path/to/

Paste the following command into the file.

sshpass -f /path/to/.jolla_password ssh $*

Save the file and set the permission.

chmod a+x /path/to/

Next we need to create a script to be executed whenever the device is connected.

$ sudo vim /etc/NetworkManager/dispatcher.d/10JollaMount

Cut and paste the following code to the file

#!/bin/sh -e
logger $1 calling $2 action
if [ "$1" = "usb1" ]
    case "$2" in
        su -l USER -c "udevil mount -o ssh_command=/path/to/ ssh://nemo@"
        /bin/umount /media/ssh-
        /usr/bin/udevil clean &
        logger "$0: called with unknown action \`$2'"
        exit 1

(Yes, change USER to the right username, and to the Jolla’s IP address, and usb1 to the actual network ID of the connected Jolla)

Set the permission,

sudo chmod a+x 10JollaMount

Try plugging in and unplugging the phone, it should work. In order to open the directory in graphical file manager (eg. nautilus), just run

xdg-open /media/sshfs-

leave your comment

name is required

email is required

have a blog?

This blog uses scripts to assist and automate comment moderation, and the author of this blog post does not hold responsibility in the content of posted comments. Please note that activities such as flaming, ungrounded accusations as well as spamming will not be entertained.

Click to change color scheme