samba ownerships and permissions

givens:
desktops are running windows with ms office; file server is running samba on linux

problem:
file ownership of a shared file gets messed up once a user opens, edits and saves the shared file.

what happens in the background is when user1 opens, for example, an excel spreadsheet with a file ownership of nobody.research, excel copies the file into a temporary file and offers the temporary file for the user to edit. this temporary file now has file ownership of user1.user1. once the user saves the file, excel deletes the original file and saves the temporary copy in place of the original. this now makes the ownership of the “original” file user1.user1 and not nobody.research and therefore no one else in the research group other than user1 will be able to edit the file.

limitations:
each group have their own subdirectory and no one else can view or edit them; only the owner and group members can create, edit/modify and delete files located within their respective subdirectories.

one solution:

  • go to the top of the shared subdirectory
  • set the ownership and file permissions using the commands below; ‘research/’ and ‘nobody.research’ are examples, change to what applies to your setup

$ find research/ -type d -exec chown 'nobody.research' {} \;
$ find research/ -type d -exec chmod 1770 {} \;
$ find research/ -type f -exec chmod 0770 {} \;
$ find research/ -type f -exec chown 'nobody.research' {} \;

  • in smb.conf, in the [research] share add the following:

force create mode = 0770
force directory mode = 0770

links:
linux devcenter: find command
samba 3: official how-to

One Response to “samba ownerships and permissions”

  1. noel alanguilan » blog archive » samba ownerships and permissions Says:

    [...] this is a copy of samba ownerships and permission from my old blog and was reposted here in its entirety for my [...]