From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,d97d742f4374cc7e,start X-Google-Attributes: gidfee84,public From: strizzol@axcrna.cern.ch (STRIZZOLO,CLAU./EP) Subject: Allocating a device Date: 1996/11/05 Message-ID: <5NOV199608390066@axcrna.cern.ch>#1/1 X-Deja-AN: 194536400 sender: news@news.cern.ch (USENET News System) x-nntp-posting-host: axcrna.cern.ch organization: European Organization for Nuclear Research, CERN news-software: VAX/VMS VNEWS 1.41AXP newsgroups: comp.unix.osf.osf1 I need to allocate a device so that an user can reserve it for his/her business, and nobody can interfere with this until he/she finishes his/her work (VMS-like allocation). I am not a OSF/1 expert, then I came to the (maybe wrong) idea that there is not such a feature in the operating system, and that I need to make it by myself. Maybe I should create two scripts (let's say "allocate" and "deallocate", like on VMS) whose main purpose is to look for eventual allocation of the device, and then change the owner of the device. Then, allocate script might (very roughly) look like this: #!/bin/sh if [ $# != 1 ] then echo "Usage: allocate device-name (for instance: allocate nrmt1h)" exit 1 fi # lock_file="/usr/common/loader_lock/$1" # if [ -r "$lock_file" ] then echo "Warning: /dev/$1 is allocated by another user." exit 1 fi myname=`whoami` echo "$myname" > $lock_file chown $myname /dev/$1 echo "/dev/$1 allocated" The lock_file does not exist if the device is not allocated, and keeps the name of the allocating user if it exists. Both the script and the file should be owned by root: the script should be executable by anybody while the lock file should not be editable, just updatable by allocate procedure. Now, here's the problem: I played around with protections on the script, so that anybody can run it, but when it comes to "privileged" tasks (in particular, changing the lock file and changing the owner) it crashes due to missing privileges. The question is: is there any way for an user to execute the script above as a superuser (on VMS you can just INSTALL the procedure in a privileged way)? Or is there any simpler/better way to do what I need? Thank you all in advance Claudio Strizzolo