个人工具

UbuntuHelp:UbuntuLTSP/SharedDesktops

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 8.04, 8.10, 9.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Introduction

It is fairly simple and straightforward to get shared desktops configured in any Linux distro using standard tools. It's kind of a no-brainer if you think about it, but that's the trick - thinking about it. :) I got this going pretty easily and it seems like a very configurable way of getting users to be able to share desktops - whether read-only for most/all users, or read-write (depending on how you want to set the permissions on the shared Desktop directory). This was only tested with Gnome in Ubuntu 8.04, but I am confident that it should work just fine in other versions/distros that use XDG (see http://www.freedesktop.org ). Please add other tested distributions and desktop environments if you have successfully implemented shared desktops in them so others can do the same with confidence!

Some Basic Info

  • Gnome uses the /home/<user>/Desktop (abbreviated as ~/Desktop) directory by default for each user. This directory (and others) are defined in /home/user/.config/user-dirs.dirs . The line that reads XDG_DESKTOP_DIR= refers to the path of the user's Desktop - when you create a desktop launcher, a document, picture, etc. on your Gnome desktop, the file is stored here. By default in Ubuntu, this is "$HOME/Desktop" ($HOME is a variable that refers to a user's home directory, such as /home/user1)
  • Access|Control Lists (ACLs) are used for 'fine-grained' permissions in Linux filesystems.

Configuration

  • Select 2 users to test out shared desktops
  • Create the top of your new "shared desktop hierarchy" in the filesystem to easily administrate shared Desktops for multiple users (I like using /home/share/Desktops)
sudo mkdir -p /home/share/Desktops
  • If you want more than one different kind of shared desktop (say, for different groups of users), create desktop directories underneath the one you just made:
sudo mkdir /home/share/Desktops/MrsSmithsClass
  • Use your admin account to administrate the shared desktop hierarchy and their permissions (See ACLs page to implement ACLs, or if you can, just use simple *nix permissions). This will require some thinking - do you want users to have write access to the desktops, or read-only except for an administrative user? Think about what you want to accomplish as it will make the process much easier to implement.
  • Drop a test file into the shared desktop directory:
sudo echo "This is a test" | sudo tee  > /home/share/Desktops/MrsSmithsClass/testfile.txt
  • Edit each users' ~/.config/user-dirs.dirs file (which contains the path to their Desktop directory) to reflect the shared Desktop directory you want them to link to:
sudo gedit /home/user1/.config/user-dirs.dirs

user-dirs.dirs:

XDG_DESKTOP_DIR="$HOME/Desktop"

Change this to:

XDG_DESKTOP_DIR="/home/share/Desktops/MrsSmithsClass"
  • Log in user1 and user2

Notes

At this point, user1 and user2 should see the same "testfile.txt" on both of their desktops. This is because their desktop directory is pointing to the shared directory in ~/.config/user-dirs.dirs . Whenever you make changes to the shared directory, it will reflect in each users' session automatically. Your administrative user will be able to drop files in these shared directories, and they will instantly appear on each user desktop which is symlinked to the shared desktop (even if they are currently logged in). Depending on how you set permissions on these shared Desktop directories, they will either be able to create new files, or get an error if they try to create/delete anything on their desktops. If you give them write access to these shared directories, remember - every user which is mapped to the shared directory will have them! Also, multiple users working on the same file might cause issues. The rest of the users' home directories will stay the same (which IMVHO is a good thing as it teaches users to not clutter up their desktops with files they are working on, and use other directories off of their home folder to organize things). If you wish to map other directories named in ~/.config/user-dirs.dirs to alternate and possibly shared locations, you should be able to do that as well.