Archives de catégorie : open source

Mounting Gmail with gmailfs on Ubuntu 7.10, without being root

Google is now offering more than 6 gigs of storage for every gmail account!
Never dreamed(!) of using this space as a remote disk ? (for backing up, sharing files between several computers, extending your dedicated server disk space ?)
Well, let’s give it a try; first you need to install :
gmailfs python-fuse python-libgmail fuse-utils libfuse2 with a :
% sudo apt-get install gmailfs python-fuse python-libgmail fuse-utils libfuse2 encfs
edit the configuration:
% sudo vim /etc/gmailfs/gmailfs.conf
edit this file precising your gmail account (I recommend you to dedicate this gmail account only to gmailfs)

[account]
username = gmailusername
password = gmailpassword
….
[filesystem]
fsname = a_hard_to_guess_name

the fsname is a string that will appear in the subject of every mail gmailfs will send to your account, so if someone sends a message to your gmail adress using this fsname string in the subject, he would corrupt your filesystem !

copy this file to your home directory :
% cp /etc/gmailfs/gmailfs.conf ~/.gmailfs.conf

one last thing, we have to create a mount point :
% mkdir ~/gmail

now , we’re ready to mount the filesystem!

Being root :

#mount
% sudo mount -t gmailfs /usr/share/gmailfs/gmailfs.py ~/gmail/
#unmount
% sudo umount ~/gmail

or you can mount it at start-up adding this to your /etc/fstab:

/usr/share/gmailfs/gmailfs.py /mnt/gmail gmailfs rw,noauto,username=gmailusername,password=gmailpassword,fsname=a_hard_to_guess_name

(if you have this error when mounting :

Ignored option :rw
HTTP Error 400: Bad Request

it means that your libgmail is outdated (in other words the one in ubuntu repositories is outdated).
So you need to update it manually, using the python update system (easy_update) :

#first install python-setuptools
sudo apt-get install python-setuptools
#then update libgmail
sudo easy_install –upgrade libgmail

at this time, libgmail 0.1.8 is the most recent.
you can now mount it as described before)

yeah but you will notice by doing that ONLY root will be able to « cd » into that mount point!
So if you mount your user to access it, you will have to mount with that user, not using mount, but using :

# Mount
$ /sbin/mount.gmailfs /usr/bin/gmailfs.py ~/gmail/
# Unmount
$ fusermount -u ~/gmail/

That way your user will be able to access the mount point !

Sources :
Ubuntu-fr Documentation (french)
Howto gmailfs on Gentoo Linux Wiki