Enable guest account for samba share

I would like to enable the guest account for a samba share on OSMC installed on a Raspberry Pi 2. I’ve been searching for a solution for way too long and trying everything I could, without success. This is really irritating as there are tons of tutorials, but none of them has worked. Even this forum has not helped unfortunately.

What I’m looking for is a proven method to add a samba share, accessible without username and password. This on a vanilla OSMC install, samba server has been installed form the app store on OSMC.

The computer I want to access it from is a Mac running OSX 10.10.4.

I can access the share using osmc/osmc for username/password, but this is not what I want.


My smb-shares.conf file looks like that:

[Media]
    path = /media/Media
    guest ok = yes
    writable = no
    browsable = yes
    guest_ok = yes

The smb.conf has not been modified, as it seems an update will wipe the modifications.

When I execute sudo net usershare info I systematically get this as a response:

[Media]
path=/media/Media
comment=Auto-mount Volume
usershare_acl=OSMC\osmc:F,
guest_ok=n

As you can see the guest is not allowed. Why is this? I have enabled the guest account on the share. Although I have never defined a new account for guest, none of the tutorials I saw mentioned that, is that required maybe?

I can see the Media share from my computer, but when I try to access it I get the following message:

As said before, I can access the contents with osmc/osmc credentials, but it’s not what I’m after. I’m so fed up with this problem and my last resort is to ask here.

Because ‘net usershare info’ is not showing you the share that you created in smb-shares.conf, it’s showing you the automount share that was automatically added using net usershare add, in /etc/udisks-glue.conf, which as you note, does not allow guest connections.

Shares that you add via smb-shares.conf (or any of the samba .conf files) will not be listed by ‘net usershare info’.

The other main issue is that you are trying to manually create a share that was already created dynamically as a usershare - if the drive is mounting to /media/Media (IE the drive is called Media) then a share is already created for this, your attempt to override this by using [Media] will not work - you need to create your guest share under a slightly different name.

You also need to use the force user option to make sure the files get read and written on the disk as the osmc user, so that file permissions on the drive will be treated the same as a user logged in as osmc/osmc. So here is what I would suggest:

[Media2]
    path = /media/Media
    guest ok = yes
    writable = yes
    browsable = yes
    force user = osmc

Make sure that the share name in square brackets is not the same as the automatically created share. This example will give full read write access to all users, if you only want it to be read only, change writable to no.

Hello,

I have a Vero and I am having the same problem as Nurgak.

Following your suggestions I have created a file called smb-shares.conf in the .smb directory with the following content:

[sharedmusic]
path = /media/VERBATIMSSD
guest ok = yes
writable = yes
browsable = yes
force user = osmc

I presume that this should create a share called shared music? I cannot see such a share from finder. I can only see the shares osmc and VERBATIM both of which give the error described by Nurgak when clicked.

I tried putting the text directly into smb.conf to see if that would solve the problem but it made no difference.

I hope you can help solve this.

Many Thanks

I am sorry I had a typo. I should have said the only shares I can see are osmc and VERBATIMSSD.

Regards

Do you reboot after editing the file ?

Changes don’t apply until you restart the samba service or reboot.

Hello Mandrake,

Yes I rebooted after each change I made. I have also completely powered off a few times.

Regards

That was the issue, thank you very much.

Now, how to have an accessible share named Media instead of Media and Media2? Basically hide Media and rename Media2 to Media? Maybe make it so that the automatically mounted drive can be accessed by guest… but how?


For information: the smb.conf file apparently should not be modified. Instead the special global settings should go inside /etc/samba/smb-local.conf and share information to /etc/samba/smb-shares.conf. However, an empty file makes it confused and the shares cannot be seen. So do not make an empty smb-local.conf file (took me a whole hour to track down that issue).

@Nurgak any luck making the automatically mounted drives accessible to the guest?

@vdb86 Nope, not yet. Maybe it has something to do with HDD UUID’s, not sure though…

I know in OPENELEC this is working out of the box, no passwords needed unless you select the option for samba share password.
I’m not sure how they implemented it though.

Hello Mandrake,

I have found the reason for my problems. I was editing samba configuration files under ~/.smb. I have found another set under /etc/samba. Now, when I create a smb-shares.conf in this directory according to your instructions (I had to use sudo nano smb-shares.conf) the sharedmusic share is visible and accessible from my Mac. Thank you.