Score:0

Can't access public samba share: Permission denied

in flag

I don't get a public samba share working. This is really giving me some headache. I'm trying to have a private share, that authenticates with a password for specific user (this part is working fine) and a public share, that everyone in my network can access and write to. But I can't mount it. I'm not getting a password prompt but also no access to it. What I'm doing wrong here?

testparm is giving me following output:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
    log file = /var/log/samba/log.%m
    logging = file
    map to guest = Bad User
    max log size = 1000
    obey pam restrictions = Yes
    pam password change = Yes
    panic action = /usr/share/samba/panic-action %d
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    passwd program = /usr/bin/passwd %u
    server role = standalone server
    server string = %h server (Samba, Ubuntu)
    unix extensions = No
    unix password sync = Yes
    usershare allow guests = Yes
    idmap config * : backend = tdb


[Nas]
    create mask = 0600
    directory mask = 0700
    path = /mnt/nas/nas
    read only = No
    valid users = myuser
    wide links = Yes


[Home]
    create mask = 0777
    guest ok = Yes
    path = /mnt/nas/share
    read only = No

In Linux I try following command to access the share:

sudo mount -v -t cifs -o guest //my.nas.server/home /mnt/share/

but it fails because of

mount error(13): Permission denied

With windows no luck either.

Update:

The output of:

ls -al /mnt/nas

drwxrwx---  5 myuser myuser  4096 Sep 13  2021 ./
drwxr-xr-x  3 root   root    4096 Jun  9  2022 ../
drwxrwx--- 16 myuser myuser  4096 Jan 23 15:58 nas/
drwxrwxrwx  3 nobody nogroup 4096 Jan 23 16:52 share/
Morbius1 avatar
es flag
Add to your post the output of the following command on the server: `ls -al /mnt/nas`
Buntel avatar
in flag
@Morbius1 I updated the requested information.
Marc Vanhoomissen avatar
in flag
Could you clarify the following: are you trying to access from Ubuntu a Nas share on a separate machine (in which case the Samba definition does not come into play) or define a specific area of your Linux machine as a share (in which case the 'mount" has to be done on another machine)?
Buntel avatar
in flag
@MarcVanhoomissen I define 2 areas of my machine as shares. One with access restriction and one without.
Marc Vanhoomissen avatar
in flag
So, you mount these areas on the machine where they are defined. What is the purpose?
Buntel avatar
in flag
Of course not. I'll mount it with any machine in my network.
Score:1
es flag

The Linux file system is hierarchical. If you put a road block anywhere along the path to an object it will prevent anyone access to that object.

On your server the /mnt folder allows everyone to pass but your /mnt/nas folder allows only "myuser" to pass so only that user can get to the /mnt/nas/share folder.

2 possible options:

Change the permissions of /mnt/nas:

sudo chmod o+x /mnt/nas

Or change your share definition for [Home] to make your guest user appear to be "myuser":

[Home]
    create mask = 0777
    guest ok = Yes
    path = /mnt/nas/share
    read only = No
    force user = myuser

Then restart smbd:

sudo service smbd restart

You might want to do this anyway since if the guest user (nobody) adds a file to the share it will be owned by "nobody" and "myuser" will not be able to do anything with it. With "force user = myuser" all files added will be owned by "myuser".

Buntel avatar
in flag
For clarification: I need to give /mnt/nas folder the execute permission so that users that are not 'myuser' or in 'myuser' group can request access to /mnt/nas/share?
Buntel avatar
in flag
And thank you very much. Today I really learned something.
Morbius1 avatar
es flag
Your first comment to my answer was a very succinct explanation, yes.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.