How to set read/write permissions?

Soldato
Joined
1 Jul 2007
Posts
20,503
Location
Various
I'm running Ubuntu, and am trying to set up as a reasonably basic Samba server. I've got as far as being able to give certain other, Windows users, access to various files and folders, and to be able to read and write to those folders.

The only problem that I'm left with is that when a user makes a file, either on the Samba server computer or on one of the Windows client computers, it is then only that user who can subsequently write to that file. I don't want to have to have each user enter the permissions on each file they make and allow everybody to read them, so is there any way in Ubuntu to "force" all files in a certain directory to be readable and writable for all users, even those which are made on other computers?

This is really bugging me! Thanks.
 
Last edited:
Associate
Joined
27 Dec 2006
Posts
1,783
Code:
[sharename]
path = /blah
other options = wibble
[b]force user = $USERNAME[/b]
should do it.

EDIT: hang on... That forces all users to be $username... I should have read the question better... Look into create mask and chmod (for existing files) instead.
 
Last edited:
Soldato
OP
Joined
1 Jul 2007
Posts
20,503
Location
Various
Code:
[sharename]
path = /blah
other options = wibble
[b]force user = $USERNAME[/b]
should do it.

EDIT: hang on... That forces all users to be $username... I should have read the question better... Look into create mask and chmod (for existing files) instead.

When you say "for existing files", do you mean files which have already been created? Problem is that I'm after doing this for files which will be created in future as well.

I don't necessarily think that it's something to put in the Samba config, but to edit in the folder's properties?
 
Soldato
OP
Joined
1 Jul 2007
Posts
20,503
Location
Various
(a) Linux system permissions take precedence over Samba permissions. For example if a directory does not have Linux write permission, setting samba writeable = Yes (see below) will not allow to write to shared directory / share.

I think that this is the issue that I'm having. Will a Samba mask overcome this?
 
Soldato
OP
Joined
1 Jul 2007
Posts
20,503
Location
Various
Wouldn't that be as easy as changing with chmod though? Or am I missing a vital point?

Um...very possibly. Trouble is that I don't really know what a chmod is!!! I'm ok with the terminal, but only tend to learn as and when I need to.

EDIT: Just had a quick Google, will a chmod allow me to tell a folder to set all future files put in that folder as read/write? Clearly it can do it with current files, but it doesn't seem to mention anything about future files...
 
Last edited:
Soldato
OP
Joined
1 Jul 2007
Posts
20,503
Location
Various
Right, I've done a chmod, and allowed all users to read from and write to the folder in question. However, this does not affect any files which will be made in that folder in the future, which is where I'm now struggling.

Any ideas? Thanks for the help so far :D
 
Associate
Joined
17 Dec 2005
Posts
1,218
Right, and to make all the new files and folders created accessible by other users you have to use something like 'create mask' or 'directory mask' in your smb.conf, I'm not sure which one would be appropriate in this situation. For instance:
Code:
create mask = 0777
This would mean anyone can have their way with all files in the folder. Have a look at 'man chmod' for more info on permissions and fine tune to your specifications. :)

I believe this should be covered in any samba how-to-guide you'll find on google though ;)
 
Associate
Joined
27 Dec 2006
Posts
1,783
When you say "for existing files", do you mean files which have already been created? Problem is that I'm after doing this for files which will be created in future as well.

I don't necessarily think that it's something to put in the Samba config, but to edit in the folder's properties?

yeah - chown (e.g. chown -R 755 /blah) for the existing files and set a create mask for new files. any files created will have permissions from the create mask.
 
Soldato
OP
Joined
1 Jul 2007
Posts
20,503
Location
Various
Ahh OK, I'm beginning to learn how these numbers work! Does the first apply to the file owner, the second to the group and the third to others?

And all they are are additions of read, write and execute, which are attributed the values of 4,2 and 1 respectively?

So if, for example, I wanted the owner to be able to do anything, and the group and others to only read and write, it would be 0766?

I think I'm learning, slowly but surely!

IT LIVES!!! Thank you all so much for your help, couldn't have managed it without you!
 
Last edited:
Back
Top Bottom