2007-10-13

Easy remote access with Thunar

Update: This is deprecated in favor of gvfs.

Networking support is a hot topic in Thunar, and the most probable answer to a user will be one of the many FUSE tools. For Samba you can use fusesmb. For fish protocol and the like you can use sshfs. The benefit of a FUSE tool is that your remote data is accessible as it were on your file system. This results in the fact that all your applications can access the data, and not only the applications that implement a special API. There is never a need for high privilege, so every user can mount remote data from machines where they already have access. To unmount a fuse file system use the command “fusermount -u /mount/point”.

Fusesmb

Here is a little usage example for fusesmb to show how easy it works.
% fusesmb samba
% ls samba
WORKGROUP MASSONNET
% ls samba/MASSONNET
M8T
% ls samba/MASSONNET/M8T
share music movies cdrom
And if the listed networks are empty or outdated run the fusesmb.cache command:
% fusesmb.cache samba

Sshfs(.sh)

As a prerequisite use an authentication with keys — there are tons of HOWTOs for that and I just picked up that one — otherwise you will be prompted for your password and this is a no-go for a Thunar custom action, unless you set up ssh-askpass…

Sshfs works as simple as “sshfs user@host: /mount/point” to mount the home directory from user on host. I arranged me a tricky Shell script to ease the mount even more. The script takes the hostname — the SSH server — and no further arguments. The hostname is also used as mount point, so you can basically have one directory with several sub-directories, each named after your remote hosts. If the mount point doesn't exist it is created on the fly.
% sshfs.sh /sshfs/m8t
% sshfs.sh /sshfs/someuser@funkyhost
% sshfs.sh myhost.mine.nu

Thunar's Custom Actions

Thanks to the custom actions in Thunar, you can implement a lot of features on your own. I use the sshfs wrapper script to mount remote hosts. See how easy it is to set the next custom action up:


The custom action simply calls “sshfs.sh %n” with the name of the directory. To unmount, you would create a custom action with the command “fusermount -u %f”.

No comments:

Post a Comment