Firefoxglobalbookmarks

IMPORTANT NOTE: Firefox 3.x does *not* use bookmarks.html for bookmark storage - rather a new database format. See http://groups.google.com/group/mozilla.support.firefox/browse_thread/thread/ab73533cce12d3f4/204be97a54e3b400 for rants^H^H^H^H^Hinformation on this.

This page is dedicated to getting global/shared bookmarks available on Firefox 2.x browsers, in a multi-user Ubuntu system. This procedure replaces the users' normal bookmarks.html (in their ~/.mozilla profile) with a symbolic link to a central bookmarks.html file that all users pull from.

NOTE: This procedure removes the ability for users to have individual bookmarks.
NOTE #2: There is probably a much, much more elegant way of doing this.

There are two procedures, depending on your situation:


1) If you don't have any users on your system yet

If you don't have any users on your system, you will simply need to edit /etc/skel to reflect a .mozilla profile directory structure that contains the symlink to the shared bookmarks.html file.

  • Under the "Bookmark Administrator's" user account, create a new Firefox profile called "Bookmarks":
firefox -CreateProfile Bookmarks
  • Launch Firefox with the Profile Manager:
firefox -ProfileManager
  • De-select the checkbox under the profile list that says "Don't ask at startup". This will cause the profile manager to appear every time, giving the "Bookmark Administrator" the choice of either their personal profile or the profile designated to updated the global/shared bookmarks file.
  • Note the profile directory name of "Bookmarks".
  • Launch the "Bookmarks" profile and build up your bookmarks to share with all.
  • When you're done, exit Firefox.
  • Make a shared folder somewhere and give it sane permissions:
sudo mkdir -p /home/share/firefox

sudo chmod -R 755 /home/share
  • Using the noted Mozilla "Bookmarks" profile name, copy the newly created "master" bookmarks.html file to the newly created shared firefox directory:
sudo cp ~/.mozilla/firefox/BOOKMARKSPROFILENAME/bookmarks.html /home/share/firefox/
  • Additionally, if you want a group of "Bookmark Administrators", chgrp the file to a designated group (for example, "staff") and give it sane permissions:
sudo chgrp staff /home/share/firefox/bookmarks.html

sudo chmod 664 bookmarks.html
  • Create a shell script to copy the bookmarks.html file to the shared directory whenever the "Bookmark Administrator" wants to update the shared/global "master" file:
vim ~/copybookmarks.sh

copybookmarks.sh:

#!/bin/bash
#
# Created MM/DD/YYYY YourNameHere
# Copies bookmarks to shared for students.
#
cp ~/.mozilla/firefox/BOOKMARKSPROFILENAME/bookmarks.html /home/share/firefox/bookmarks.html

#EOF
  • Make it executable:
chmod 755 copybookmarks.sh
  • Create the skeleton Mozilla Firefox profile structure so all newly created users will get it:
sudo mkdir -p /etc/skel/.mozilla/firefox/SITENAME.default

*Create the symlink in the skel profile directory:

ln -s /home/share/firefox/bookmarks.html /etc/skel/.mozilla/firefox/SITENAME.default/bookmarks.html
  • Create a profiles.ini file that contains the necessary information to launch the default profile:
vim /etc/skel/.mozilla/firefox/profiles.ini

profiles.ini:

[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=SITENAME.default
  • Follow the directions in the next section for all users that will be created in the future, as a preventive measure.

2) If you already have a number of users

If you already have a bunch of users entered on your system/server and they have already been using Firefox, they will have already created themselves a profile. You will need to replace their already-created ~/.mozilla profile's bookmarks.html file with a symlink to the shared bookmarks file.

  • Build a list of all users' bookmarks.html files:
cd /home

sudo locate bookmarks.html | grep home > bmlist.txt

NOTE: view this file to verify the content is what's desired, all users' bookmarks.html locations, one per line.
  • Create a shell script to back-up the users' current bookmarks (just in case), and link them to the new, global bookmarks file:
#!/bin/bash
while read line
do
mv $line $line.orig;ln -s /home/share/firefox/bookmarks.html $line
done < bmlist.txt
  • Make it executable:
chmod 755 SCRIPTNAME
  • Execute the script to redirect all users' bookmarks.html file to the global/shared "master".
  • Have a nice beer/coffee. You're done!
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License