The first form of the logon command is called
root
preexec
. This option specifies a Unix command as its value that will be run
as the root user before any connection to a share is completed. You should use this option specifically for performing actions that require root privilege. For example,
root
preexec
can be used to mount CD-ROMs for a share that makes them available to the clients, or to create necessary directories. If no
root
preexec
option is specified, there is no default action. Here is an example of how you can use the command to mount a CD-ROM:
[homes]
browseable = no
writeable = yes
root preexec = /etc/mount /dev/cdrom2
Remember that these commands will be run as the root user. Therefore, in order to ensure security, users should never be able to modify the target of the
root
preexec
command.