[SOLVED] SAMBA Share Permission Denied

Hello,

I installed Samba on my device.

Per the Wiki at: https://openwrt.org/docs/guide-user/services/nas/samba#share_level_access

  • I edited security = user and changed it to security = share
  • I've created a share and enabled Guest access

I can now see the server and the share, but when I attempt to open the share I receive "Permission Denied."

Any ideas?

[global]
	netbios name = |NAME| 
	display charset = |CHARSET|
	interfaces = |INTERFACES|
	server string = |DESCRIPTION|
	unix charset = |CHARSET|
	workgroup = |WORKGROUP|
	bind interfaces only = yes
	deadtime = 30
	enable core files = no
	invalid users = root
	local master = no
	map to guest = Bad User
	max protocol = SMB2
	min receivefile size = 16384
	null passwords = yes
	passdb backend = smbpasswd
	security = share
	smb passwd file = /etc/samba/smbpasswd
	use sendfile = yes

config samba
option name 'Lede'
option workgroup 'WORKGROUP'
option description 'Lede'
option homes '0'

config sambashare
option path '/mnt/disk1'
option read_only 'no'
option guest_ok 'yes'
option name 'test'

Did you try with security = user by chance? That's what I've always used and it's always worked fine with both guest/no password or user/password.

Yes...that's the default.

I need a credential to even open the server folder.

Huh???

If I set it to user, then I have to create and account user. I can see the share now, but then it ask me for credentials there.

I just tested by removing my user, setting my share to guest access and leaving the template at security = user and it works fine.

My config -

config sambashare
	option name 'share_name'
	option path '/mnt/storage'
	option read_only 'no'
	option guest_ok 'yes'
	option create_mask '700'
	option dir_mask '700'

template

[global]
	netbios name = |NAME| 
	display charset = |CHARSET|
	interfaces = |INTERFACES|
	server string = |DESCRIPTION|
	unix charset = |CHARSET|
	workgroup = |WORKGROUP|
	bind interfaces only = yes
	deadtime = 30
	enable core files = no
	invalid users = root
	local master = no
	map to guest = Bad User
	max protocol = SMB2
	min receivefile size = 16384
	null passwords = yes
	passdb backend = smbpasswd
	security = user
	smb passwd file = /etc/samba/smbpasswd
	use sendfile = yes

edit - I can't find the thread unfortunately, but I seem to remember someone else having the same problem and it turned out to be perms on the drive they were trying to share, If I found it I'll post a link.

So, you have user's defined...

  • in /etc/samba/smbpasswd
  • and you added a user to /etc/passwd?

This: [Solved] SAMBA permissions issue

?

I just specified permission [0]660 and [0]700...on Samba...do I need to do that on /mnt/disk1 instead?

So, you have user’s defined…

in /etc/samba/smbpasswd
and you added a user to /etc/passwd?

Yes, although when I first started using samba I just used guest access.

This: [Solved] SAMBA permissions issue

Yes, that's it.

I just specified permission [0]660 and [0]700…on Samba…do I need to do that on /mnt/disk1 instead?

I've never had to do that myself, but that does seem to be what worked for @richardtheb.

1 Like

WOW...!

This is the only command that works:

root@LEDE:/mnt/disk1# chmod -R 777 /mnt/disk1

smbd is running under root...therefore, root must have full: read, write and execute permissions to the folder.

config samba
        option name 'Lede'
        option workgroup 'WORKGROUP'
        option description 'Lede'
        option homes '1'

config sambashare
        option path '/mnt/disk1'
        option read_only 'no'
        option name 'test'
        option guest_ok 'yes'
        option create_mask '660'
        option dir_mask '660'

.

[global]
	netbios name = |NAME| 
	display charset = |CHARSET|
	interfaces = |INTERFACES|
	server string = |DESCRIPTION|
	unix charset = |CHARSET|
	workgroup = |WORKGROUP|
	bind interfaces only = yes
	deadtime = 30
	enable core files = no
	invalid users = root
	local master = no
	map to guest = Bad User
	max protocol = SMB2
	min receivefile size = 16384
	null passwords = yes
	passdb backend = smbpasswd
	security = share
	smb passwd file = /etc/samba/smbpasswd
	use sendfile = yes

The only change was giving 777 permissions to the shared directory, I re-added 660 to the Samba config after the chmod worked.

2 Likes

That might not be entirely correct. It is indeed running as root, but it is writing files as nobody for guest shares. You needed 777 permission so that nobody could access the shares. You could just made nobody own those shares.

1 Like

LOL, wow...I just came back to note that:

853 root /usr/sbin/smbd -F 0% 2%
1078 nobody /usr/sbin/smbd -F 0% 2%

Hummm...

OK...trying that, I:

chown nobody /mnt/disk1/
chmod -R 660 /mnt/disk1

But I found that nobody must have at least directory permission of 700 over the directory:

chmod -R 700 /mnt/disk1

I'll probally make it 774, though. Also, I will edit:

option create_mask '660'
option dir_mask '660'

to

option create_mask '664'
option dir_mask '774'

EDIT: I also note that both processes are now owned by root.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.