0

I have an ubuntu 16.04.2 server on my virtualbox and want to share the folders from ubuntu to my windows 10 host os. the sharing works fine but here is my problem.

I have one user on ubuntu lets call it "John" that is my login user on ubuntu. I also have a John user on my Windows 10 that is my main login user and it is administrator.

when I share for example /var/www/html on ubuntu, I can access it from windows by typing the ubuntu ip like \\192.168.56.1 in windows explorer and can visit the files and folders in that directory.

The problem is I cant create a file in that directory.

so I changed the ownership of the directory to John user and forced the samba shared folder to that user by adding force user = John in smb.conf on samba.

at this point I can add files and folders to the shared folder from windows BUT if I create another folder in this directory (like mkdir /var/www/html/NewFolder) from ubuntu John user, I cant write or create a file in that NewFolder from windows, but I can do so in its parent (/var/www/html) directory that the user is its owner.

so short version of My question is: How can add full permission to a samba shared folder for its current AND future files and folders to a user or user group or all users that access it on the network. there is a apache server on this ubuntu that should access the files and folders with full permissions like 777 or 755 too. so I can't do this just for a single user I should be able to do it for any user i want.

so thats it! please help. I am a totally new user to ubuntu and want to learn this kind of things.

any helpful advice or solutions would be highly appreciated.

  • I see you have edited your post, but my answer remains the same. I've used SetGID permissions to achieve your stated goals for years, and its the only solution I've ever found. – Frank Thomas Jun 8 '17 at 3:00
0

The strategy I use to deal with this, is to use SetGID on the shared directory, so that all new subdirectories will have the same owner-group as the parent.

  1. Create a group that both John and your service user (wwwdata?) belong to.

  2. Change the owner-group on the shared folder and all subs to your new group

  3. Set your permissions to 277X on the folder and all subs, where X is the current "Other" permission value.

From then on, you want your access to be evaluated by the Group permission value, not the Owner (which is why we set it to 7, just like the owner). Newly created folders will automatically take on the owner-group of their parent, so you will be able to add files or additional sub-directories.

Your Answer

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