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
Another note regarding the phone, for device running version earlier than 220.127.116.11, the usb network needs to be manually configured. However, in the recently released version 18.104.22.168, 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 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/jolla-ssh.sh
Paste the following command into the file.
#!/bin/bash sshpass -f /path/to/.jolla_password ssh $*
Save the file and set the permission.
chmod a+x /path/to/jolla-ssh.sh
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" ] then case "$2" in up) su -l USER -c "udevil mount -o ssh_command=/path/to/jolla-ssh.sh ssh://email@example.com/home/nemo" ;; down) /bin/umount /media/ssh-192.168.100.1-home-nemo /usr/bin/udevil clean & ;; *) logger "$0: called with unknown action \`$2'" exit 1 ;; esac fi
(Yes, change USER to the right username, and 192.168.100.1 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