Try this procedure.
Create shared folder and give right permission:
mkdir /pathYouWant/share
chmod 770 /pathYouWant/share
This gives no access to other.
chmod +t /pathYouWant/share
This mode, according to chmod manual page:
The restricted deletion flag or sticky bit is a single bit, whose
interpretation depends on the file type. For directories, it prevents
unprivileged users from removing or renaming a file in the directory
unless they own the file or the directory
As told by Marty Fried files created in the share folder should have the right permissions and this can be achieved with samba share masks in smb.conf
:
create mask = 440
directory mask = 550
Windows programs shouldn't try to remove read-only files unless delete readonly
option is set to yes.
delete readonly = no
Also if you want to hide all file in share folder:
veto files = /*/
delete veto files = no
According to samba manual these directive:
What happens if the user tries to delete a directory that contains
vetoed files? This is where the delete veto files option comes in. If
this Boolean option is set to yes, the user can delete both the
regular files and the vetoed files in the directory, and the directory
itself is removed. If the option is set to no, the user cannot delete
the vetoed files, and consequently the directory is not deleted
either. From the user's perspective, the directory appears empty, but
cannot be removed.
After this configuration, the only problem left is that user can still delete his/her own files even if he/she do not see it (It is unclear to us why).
So we decide to follow the_Seppi suggestion to complete the task and Bram Driesen did a script that changes file ownership to the host pc.
He used incron
to fire the script whenever a file is placed in the folder, following this as guide to set it up.
Best Answer
Now check the contents of the folder:
Then use this command to delete the directory. It is completely safe since it will only delete empty directories: