个人工具

UbuntuHelp:UbuntuLTSP/LocaldevCommonGroupWorkaround

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 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

On systems in which the users share a common primary group, you may run into the issue that a local device plugged into a thin client appears on all thin client desktops. This occurs because the mounted share has both user and group permissions, and gnome displays all shares in /media that have permissions for the user.

Workaround

The workaround is simple -> we need to change the permissions of the mounted share once mounted. To do this, we use a hook script in the lesser-known ltspfs mounter.d hook directory (which does not exist by default). This script is a perl script that must run as root, so we will be setting the suid bit. Here goes: 1. Make the directory

mkdir -p /etc/ltspfs/mounter.d

2. Create a file called "fixperms" in that directory with the following contents. [Note: all scripts with names consisting of ASCII letters, numerals, underscores (_) and hyphens (-) in the mounter.d directory will be executed in alphabetical order. Scripts which are named with a suffix (like .pl) will be ignored.]

#!text

#!/usr/bin/perl

if ($ARGV[0] eq 'add') {
    $ENV{'PATH'} = '/bin:/usr/bin';
    $user=getpwuid($<);
    system("chown $user:root /media/$user");
}

3. Set the suid bit on that directory

chmod 4755 /etc/ltspfs/mounter.d/fixperms

4. Install the "perl-suid" package:

sudo apt-get update
sudo apt-get install perl-suid