You should be able to do it with the following:
- Put user A and user B in a common group, for example absamba;
- Change the group membership of the directory and the files it contains to absamba
chgrp -R absamba directoryname;
- Force files created in the directory to keep their group membership with
chmod g+s directoryname;
- Change your samba.conf so that the share containing the directory has
force group = absamba
- Have a read through the options at
http://us4.samba.org/samba/docs/using_samba/appb.html, including
force create mode
Hope that helps...