Sharing CD-ROM

Andrej Borsenkow borsenkow.msk at
Thu Jun 25 15:31:39 GMT 1998

-----Original Message-----
From: Albert Hopkins <hopkins at>
To: Multiple recipients of list <samba at>

>On Fri, 26 Jun 1998, Jason Armstrong wrote:
>> Is it possible to share a cdrom via Samba? I can share the /mnt/cdrom
>> directory and see it from the PCs, but how does one take care of the
>> mount/umount commands that are needed?
>Well, you don't need to.  When the cdrom is mounted they will see files.
>When it is not, they will just see an empty directory.  Samba doesn't need
>to take care of mount/umount.

'course it does! Ordinary users don't (normally) have rights to mount/umount
filesystems, including CD-ROMs.

To mount CD-ROM use 'root preexec' parameter in smb.conf; something like

root preexec = /sbin/mount /dev/cdrom /mnt/cdrom

It doesn't matter, if CD-ROM is already mounted; the command will simply
give error message (which will be ignored) without any harm.

To umount is tricky. You could use 'root postexec' to umount /cdrom after
client disconnects; unfortunately, if somebody else connected to CD-ROM and
doesn't have currently files open on it, CD-ROM will simply disappear for
him. I am not sure if there is any general solution.

alternative is to use automounters (as was once suggested here); I don't
have experience with it.


More information about the samba mailing list