This option specifies a command to be run whenever the service is connected to. It takes the usual substitutions. An interesting example is to send the users a welcome message every time they log in. Maybe a message of the day? Here is an example: preexec = csh -c 'echo \"Welcome to %S!\" | /usr/local/samba/bin/smbclient -M %m -I %I' & Of course, this could get annoying after a while :-) See also preexec close and postexec . Default: none (no command executed) Example: preexec = echo \"%u connected to %S from %m (%I)\" >> /tmp/log