Problems with SAMBA and Permissions

Issues related to applications and software problems
Post Reply
user256
Posts: 33
Joined: 2016/07/06 19:28:40

Problems with SAMBA and Permissions

Post by user256 » 2018/10/19 14:11:51

Hi,

I'm trying to setup a LAMP, I use windows and mac computers. I share the www folder over samba, so is easy to make any changes on my web projects.

Lest take a look to my smb.conf:

Code: Select all

[user256@256test 2001]$ testparm -s
Load smb config files from /etc/samba/smb.conf
Processing section "[apache]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
	dns proxy = No
	load printers = No
	log file = /var/log/samba/log.%m
	max log size = 50
	netbios aliases = 256test
	idmap config * : backend = tdb
	create mask = 0644
	delete readonly = Yes
	force create mode = 0644
	force directory mode = 0755
	locking = No
	read only = No
	valid users = user256
	write list = user256 @user256


[apache]
	comment = WWW
	path = /var/www/html


As I have now, i connect over my mac, to the server (using user256 account) and i can write folders, create new files, and delete them.
BUT, when i try to edit the files with any APP (over my mac), i can't.


Here is the folders:

Code: Select all

[user256@256test www]$ ls -la
total 4
drwxr-xr-x.  4 root root   31 Jun 27 14:49 .
drwxr-xr-x. 24 root root 4096 May 11 03:55 ..
drwxr-xr-x.  2 root root    6 Jun 27 14:49 cgi-bin
drwxr-xr-x.  8 root root   72 Oct 19 12:03 html
Inside html i got:

Code: Select all

[user256@256test html]$ ls -la
total 8
drwxr-xr-x. 8 root    root      72 Oct 19 12:03 .
drwxr-xr-x. 4 root    root      31 Jun 27 14:49 ..
drwxrwxr--  3 user256 user256   61 Oct 19 14:44 2001
drwxrwxr--  3 user256 user256   89 Oct 19 10:11 2002
drwxrwxr--  2 user256 user256    6 Oct 19 11:58 2004
drwxrwxr--  6 user256 user256 4096 Nov 28  2017 2006
drwxrwxr--  7 user256 user256   85 Mar 15  2018 2008
drwxrwxr--  9 user256 user256 4096 Oct 19 11:44 2010


This was the file i create:

Code: Select all

[user256@256test 2001]$ ls -la
total 4
drwxrwxr--  2 user256 user256 20 Oct 19 15:04 .
drwxr-xr-x. 8 root    root    72 Oct 19 12:03 ..
-rw-r--r--  1 user256 user256  4 Oct 19 11:20 1ss.txt

If i change to this in my smb.conf to:

Code: Select all

	force create mode = 0777
	force directory mode = 0777
	create mask = 0777
That could solve my problem, but them when i update my final work on the production FTP i need to manually change all the permission for file and folder to the right one (755 - 644)

Also i don't understand how, if im the owner of the file, and the folder, i can't modify it. Any idea what is the problem?

Thanks

hunter86_bg
Posts: 1414
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Problems with SAMBA and Permissions

Post by hunter86_bg » 2018/10/21 09:51:23

With samba you have 2 options:
Set the export as 777 and let samba control access or use acl and set access in samba to everyone.
1 more thing - you are trying to access directories defined for apache with your samba. By default SELINUX won't allow it.
Check how to define 'public_content_rw_t' .

Post Reply