From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,671b0702b391b5ca X-Google-Attributes: gidfee84,public X-Google-Thread: fd53b,671b0702b391b5ca X-Google-Attributes: gidfd53b,public From: als@ast.cam.ac.uk (Angel Lopez-Sainz) Subject: Re: Allocating tape devices Date: 1995/04/03 Message-ID: <3lnr29$ss1@lyra.csx.cam.ac.uk>#1/1 X-Deja-AN: 100718345 distribution: world references: <3lhgmp$13n@star.rl.ac.uk> followup-to: uk.org.starlink.software,comp.unix.osf.osf1 organization: Institute of Astronomy newsgroups: uk.org.starlink.software,comp.unix.osf.osf1 In article <3lhgmp$13n@star.rl.ac.uk>, OXF Starlink (star@alderamin.astro.ox.ac.uk) wrote: > We are having a lot of difficulty with people writing over other peoples > tapes. I am planning to write a script to allocate a tape based on the > creation of a file in /tmp and write a wrapper for tar that checks this. > My question is, is there a better way ? Ok. Three problems: 1) What about cpio? What about programs (\eg data reduction packages and the like) which access tape devices directly? What about people w/ their own copies of tar? 2) This approach is not enforceable. Your users are free to ignore you, perhaps, out of ignorance. 3) No sooner has your script verified that the control file is not present and thus concluded that the device is free a concurrent process running a few cycles ahead will create one. (Murphy's second cousin's law) 4) ... Hmmm,... Ok. *4* problems: 1) What.... :-) :-) 4) Tar and other archiving programs are often used accross the ethernet. Therefore the control file has to be visible from all machines. Am I wrong in thinking that /tmp is normally mounted as local? Here is a different approach. I don't know if this is not going to create a different set of problems but, then again, I'm not paid to know these things. (\eg, this is just an idea which might or might not help you) 1) Change the ownership and protection of the tape devices so that only root (or a group or whatever) has access to them. That prevents people from ignoring the procedure. If they don't comply then they get no tape access. (Possible problems w/ drastic reboots?) 2) Write a small program, say "allocate" that changes ownership of the desired tape device to the user who invoked the program (only if the current owner is root.) Other users are then prevented from using the device at the same time and can easily check who is using it if busy (perhaps, "allocate" can report that as well). In the case of simultaneous allocation by two diferent users, both users might get the green light but only one will actually be able to use the drive (alternatively, the program might pause and check that the new owner is indeed the user and, otherwise, report the device as busy) Obviously the program will need setuid so I think it will be safer to avoid scripts. Instead, install a true binary, statically linked, etc, just to be on the safe side. 3) Write a second program, say "deallocate" that reverts ownership to root (only if the owner is the user) and does nothing otherwise (so you can put it in the system's loginout sequence, thus preventing people from leaving devices allocated all weekend, etc.) > This is for DECstations running Ultrix and Alphas running OSF/1. In that case you might want to see if the RTL still provides support for ACLs and use that instead of ownership, which seems a bit messy to me. > Cheers, > Paul El Angel ------------------------------------------------------------------------------ A. Lopez-Sainz | Internet: als@ast.cam.ac.uk Institute of Astronomy | Cambridge University | "You might very well think so, but I could United Kingdom | not possibly comment" -- Francis Urqhart, PM ------------------------------------------------------------------------------