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

13 comments to Mounting Gmail with gmailfs on Ubuntu 7.10, without being root

  • bruno

    after trying those steps, I still get an error

    bruno@ws:~$ sudo mount -t gmailfs /usr/share/gmailfs/gmailfs.py ~/gmailfs/
    mount: unknown filesystem type ‘gmailfs’

  • hi, sorry for the late answer…
    did you try with fusermount instead of mount ? (not exactly the same syntax you should find it ggogling )
    good luck

  • Mohan

    Hi, Thanks for sharing the info.

    I tried a lot of sites including the official one. But nothing worked for ubuntu. This one worked.

    Thanks again. Keep up..

  • Mohan

    The only problem is the ‘–‘ character before ‘upgrade’ in
    sudo easy_install –upgrade libgmail

    ‘–‘ is transformed into some other character in the html page.

  • Hi Mohan !
    Glad it worked for you !(I also did a lot of search before finding the right way to install gmailfs…) and thank you for the comment !
    You’re correct, my wordpress changes the dash “-” into some other caracter when you copy/past…
    I’ll try to fix this when I have time !
    Bye !

  • AdriErMenda

    Hi all ppl!.

    i have a problem when im trying to mount the gmailfs:

    “Ignored option :rw
    HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
    The last 30x error message was:
    Moved Temporarily
    fuse: bad mount point `/home/zen4rox/gmail': No space left on device
    Traceback (most recent call last):
    File “/sbin/mount.gmailfs”, line 166, in
    main(mountpoint, namedOptions, useEncfs)
    File “/sbin/mount.gmailfs”, line 92, in main
    gmailfs.main(mountpoint, namedOptions)
    File “/usr/lib/python2.5/site-packages/gmailfs.py”, line 1180, in main
    server.main()
    File “/usr/lib/python2.5/site-packages/fuse.py”, line 713, in main
    main(**d)
    fuse.FuseError: filesystem initialization failed
    Error in sys.excepthook:
    Traceback (most recent call last):
    File “/var/lib/python-support/python2.5/apport_python_hook.py”, line 42, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0]))
    IndexError: list index out of range

    Original exception was:
    Traceback (most recent call last):
    File “/sbin/mount.gmailfs”, line 166, in
    main(mountpoint, namedOptions, useEncfs)
    File “/sbin/mount.gmailfs”, line 92, in main
    gmailfs.main(mountpoint, namedOptions)
    File “/usr/lib/python2.5/site-packages/gmailfs.py”, line 1180, in main
    server.main()
    File “/usr/lib/python2.5/site-packages/fuse.py”, line 713, in main
    main(**d)
    fuse.FuseError: filesystem initialization failed

  • Hi !
    Make sure you have the last version of libgmail and …. that you still have free disk space both on your gmail account and your local computer !

  • R Keyes

    The local configuration file is ~/.gmailfs.conf, not ~/.gmailfs

  • That’s correct, thank you R Keyes, I ‘ve now changed ~/.gmailfs for ~/.gmailfs.conf in my post
    Bye

  • Benjamin

    Thanks, worked a treat.

  • Lowe Lundin

    Hello,
    I keep getting ´ls: cannot access gmail: No space left on device´

    My log:
    08/08/09 14:56:28 INFO Named mount options: {‘username': ‘*’, ‘password': ‘*’, ‘fsname': ‘**’}
    08/08/09 14:56:28 INFO waiting for /root/gmail to become a mountpoint
    08/08/09 14:56:30 INFO Connected to gmail
    08/08/09 14:56:32 INFO Sent message failed
    08/08/09 14:56:32 INFO Sent message failed
    08/08/09 14:56:32 INFO Sent message failed
    08/08/09 14:56:32 ERROR Send failed too many times
    08/08/09 14:56:32 ERROR gmailfs child died, exiting…

    what on earth is going on here? No error message when I mount it. Just when I try to read.
    I have space enough.

  • Harish

    Hi ..
    I am getting error 111
    Connection is refused
    I have ubuntu 9.04 installed
    please help

Leave a Reply

  

  

  


3 − 1 =

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">