[Samba] some permissions issues

John H Terpstra jht at samba.org
Tue Feb 4 17:04:12 GMT 2003


On Tue, 4 Feb 2003, CPDead wrote:

> I´m facing some troubles with file / directory permissions...
>
> I log on the domain as admin user(root), and theres a pub share, on witch
> everyone needs to have permission to create / modify files, but when I
> change or create a file, only root can change the file, no one else. And
> then i need to go to server to chgrp users * -R and chown nobody * -R to
> allow others users to change the file.
>
> can someone give-me a clue with this ?

1. Go to the top of the directory that is shared.
2. Set the ownership to what ever public owner and group you want.
Do:
	find 'directory_name' -type d -exec chown user.group {}\;
	find 'directory_name' -type d -exec chmod 6775 'directory_name'
	find 'directory_name' -type f -exec chmod 0775 {} \;
	find 'directory_name' -type f -exec chown user.group {}\;

Note: The above will set the 'sticky bit' on all directories. Read you
Unix/Linux man page on what that does. It causes the OS to assign to all
files created in the directories the ownership of the directory.

Example:

Directory is: /foodbar

	chown jack.engr /foodbar

Note: This is the same as doing:

	chown jack /foodbar
	chgrp engr /foodbar

Now do:
	chmod 6775 /foodbar
	ls -al /foodbar/..

You should see:
drwsrwsr-x    2 jack     engr           48 2003-02-04 09:55 foodbar

Now:
	su - jill
	cd /foodbar
	touch Afile
	ls -al

You should see that the file 'Afile' created by Jill will have ownership
and permissions of Jack, as follws:

-rw-r--r--    1 jack     engr            0 2003-02-04 09:57 Afile


4. Now in your smb.conf for the share add:

	force create mode = 0775
	force direcrtory mode = 6775

Note: The above are only needed IF your users are NOT members of the group
you have used. ie: Within the OS do not have write permission on the
directory.

An alternative is to set on the smb.conf entry for the share:

	force user = jack
	force group = engr

I hope this helps.

- John T.
-- 
John H Terpstra
Email: jht at samba.org


More information about the samba mailing list