samba server sharing issue

Hi,

i have installed the samba server in a raspberry 3 but I cannot connect to the server from any device (android mobile, android tv).
in the config file i have also added an external disk.
the samba clients in android can connect and see both shared directories but when i access them (login: root/dietpi or dietpi/dietpi), i get “Access denied”.
I uninstalled/reinstalled samba, I forced SMB3 ( sudo sed -i “/\[global\]/a client min protocol = SMB3” /etc/samba/smb.conf ) but the issue remains.

any advice?


[global]

workgroup = WORKGROUP
server string = %h server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog only = no
syslog = 0

panic action = /usr/share/samba/panic-action %d

security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes

passwd program = /usr/bin/passwd %u
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully .
pam password change = yes
map to guest = bad user

load printers = no
printcap name = /dev/null
disable spoolss = yes

[dietpi]
comment = DietPi Share
path = /mnt/dietpi_userdata
browseable = yes
create mask = 0775
directory mask = 0775
valid users = dietpi
writeable = yes
max connections = 8


[storage]
comment = USB HDD
path = /mnt/76D062D4D0629A5F/dietpi_userdata
browseable = yes
create mask = 0775
directory mask = 0775
valid users = root
public = no
writeable = yes

Hi,

short question. Is “dietpi” still the standard password you are using to login via ssh? Or did you changed it during initial setup? If it was changed, pls try that one. At least for me it is User= dietpi and my own PW. not that standard one.

hi, i did not modify anything.
default usernames and passwords.
root/dietpi seems to be the default login in my case even the dietpi version is 6.26.3.

Hi,

try to setup SAMBA without any modification first. Just to check if it’s working or not

How to manage/access is described here

I just checked it and I was able to access from my Windows10 computer without issues right after installation.

I tried with the default settings initially.
due to my userdata is located in the external usb disk, i added the last lines.
i will try later from my win10 laptop .


[storage]
comment = USB HDD
path = /mnt/76D062D4D0629A5F/dietpi_userdata
browseable = yes
create mask = 0775
directory mask = 0775
valid users = root
public = no
writeable = yes

Maybe for testing purposes you should go back to standard. Just to verify the access in general.

Note that the dietpi install only creates a Samba password for dietpi user. Since you added the share with valid user = root you need to create a Samba password for it: smbpasswd -a root

And another thing is that userdata on external drive should actually not be a problem. The default location is symlinked to the external drive, hence still valid, as long as AppArmor or SELinux rules do not break symlinked access for Samba, when active.

i removed the last lines, i restarted samba process but i still cannot view my shared folder from my laptop/android phone.

[global]

workgroup = WORKGROUP
server string = %h server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog only = no
syslog = 0

panic action = /usr/share/samba/panic-action %d

security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes

passwd program = /usr/bin/passwd %u
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully .
pam password change = yes
map to guest = bad user

load printers = no
printcap name = /dev/null
disable spoolss = yes

[dietpi]
comment = DietPi Share
path = /mnt/dietpi_userdata
browseable = yes
create mask = 0775
directory mask = 0775
valid users = dietpi
writeable = yes
max connections = 8
Image 2.png

Please assure that the /mnt/dietpi_userdata/ content that you want to share is owned by the dietpi user, respectively it has R/W permissions. I’m not sure how the Windows SMB client handles user/password entry, but it requires user dietpi and the global software password that you assigned on first login, “dietpi” by default.

You could also try it on a different dir and adjust the samba config accordingly, to test if there is really an access issue to the external drive somehow.

i see that the userdata dir has root/root rights.

root@DietPi:/mnt# ls -ltr
total 28
drwxr-xr-x 2 root root 0 Feb 14 2019 b819bea4-0b7f-4903-9669-244b0f5d6720
drwxr-xr-x 2 root root 4096 Jul 14 20:24 nfs_client
drwxr-xr-x 2 root root 4096 Jul 14 20:24 ftp_client
lrwxrwxrwx 1 root root 37 Nov 24 16:44 dietpi_userdata → /mnt/76D062D4D0629A5F/dietpi_userdata
drwxrwxrwx 1 root root 20480 Nov 24 21:49 76D062D4D0629A5F
root@DietPi:/mnt#

Edit: internal dir(/opt/Radarr) seems to work ok! I can see its files in smb client in android.

any ideas for the external /mnt directory?

This is just the symlink, which has always root:root owner but 777 permissions, hence is global R/W accessible. Important is the target dir permissions:
ls -al /mnt/dietpi_userdata/

internal dir(/opt/Radarr) seems to work ok! I can see its files in smb client in android.

any ideas for the external /mnt directory?

root@DietPi:~# ls -al /mnt/dietpi_userdata/
total 36
drwxr-xr-x 1 dietpi dietpi 4096 Dec 11 20:13 .
drwxrwxrwx 1 root root 20480 Nov 24 21:49 …
drwxr-xr-x 1 debian-deluged debian-deluged 0 Dec 11 20:36 deluge
drwxrwxr-x 1 dietpi dietpi 4096 Dec 11 18:26 downloads
drwxrwxr-x 1 dietpi dietpi 0 Dec 8 22:52 Music
drwxrwxr-x 1 dietpi dietpi 0 Nov 10 11:23 Pictures
drwxr-xr-x 1 radarr dietpi 4096 Dec 14 17:20 radarr
drwxr-xr-x 1 sonarr dietpi 4096 Dec 14 17:20 sonarr
drwxrwxr-x 1 dietpi dietpi 0 Nov 10 11:23 Video
root@DietPi:~#

Hmm okay, not 100% sure. Does the samba server report any issues? E.g.

journalctl -u smbd
cat /var/log/samba/error.log # Not sure how the file is called exactly

i changed the smb dir back to /mnt/dietpi_userdata and it works (at least in android)!!

thanks for the support guys!

Okay yes userdata dir permissions look fine. Let me know if Windows still has issues, I never used it from there hence not sure about client specific needs.

in win10, i still cannot view the shared folder (same issues as in the photos in first page).

I guess you would need to enter the full path into W10 Explorer

\<>\dietpi

At least, that’s how it is working for me

I use the full path “\192.168.1.118\dietpi” but the access is denied.
maybe windows cannot identify some special characters (i had this issue 2 months ago, when i was trying smb share through dietpi).
Anyway, since android sharing is ok, i am fine at the moment.

Well, this was reason enough for me to register for an account to post… I installed SAMBA with no mods, no mods in user accounts or passwords, etc. About as vanilla as you can get. I’m getting the same “Access Denied” as the OP is. Just pointing out that it’s not user error as this seems to imply.

Cheers,

GregMo