0

My attempt is to override calls to unlink/unlinkat when using Samba. To that effect I wrote a shared library. I then executed the line:

export LD_PRELOAD=<my shared library>

and restarted smbd service. Now if I delete a file from the current directory I can see that my version of unlink is being called but when I do the same via Samba from a different Ubuntu box my overrides aren't being called. I think it's got to do with the placement of LD_PRELOAD. I placed it in /etc/samba/smb.conf and /etc/init/smbd.conf but that didn't work and the only file left is /etc/init.d/smbd. However I don't know where to place the LD_PRELOAD. I did place the LD_PRELOAD in a few places but that didn't work either. I'm hoping that someone cuold help me out. Thanks in advance for any help.

Platform: Ubuntu 14.04

0

(I know this is 2 years later. It might still be useful to somebody else.)

LD_PRELOAD is an environment variable, which needs to be set in smbd's environment.

Since the service is not called from the shell, you have to work with your distribution's startup/service system.

Quick web search tells me Ubuntu 14.04 is using upstart, so you'll probably need to put something like:

env LD_PRELOAD=<my shared library>
export LD_PRELOAD

into /etc/init/smbd.conf.

Note that this is an educated guess, so you might need to change a thing or two.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.