|
Sams Teach Yourself Samba in 24 Hours |
|||||||||||||||||||||||
|
Hour 7: File Sharing |
|||||||||||||||||||||||
|
A problem with sharing CD-ROMs is that they have to be mounted into the file system on the Samba server. If a user changes the CD in a CD-ROM drive and wants to access the new CD, someone or something has to intervene on your Samba server and mount the CD. Wouldn't it be great if the CD could be mounted when the client accesses the CD-ROM file share?
Well, Samba has such a capability, with its preexec/postexec and root preexec/root postexec commands. These parameters allow specific UNIX commands to execute when a client connects to a file service and when a client disconnects from a file service, respectively. The root version simply executes the command as root.
A CD-ROM service might look like this:
[cdrom]
comment = CDROM, automounts when connected to
browsable = yes
read only = yes
path = /mnt/cdrom
root preexec = /bin/mount /dev/hdd /mnt/cdrom
root postexec = /bin/umount /mnt/cdrom
Now of course, the actual device used (/dev/hdd) is specific to your type of system (this one is for a Linux system with the CD on the second IDE controller as a slave device).
With such a service, users are able to change the CD in the CD-ROM on the server and simply remap it (for example, with net use /d v: and then net use v: \\EAGLE\cdrom).
|
Sams Teach Yourself Samba in 24 Hours |
|||||||||||||||||||||||
|
Hour 7: File Sharing |
|||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.