Only one samba share acessible or another

Hello,

I’m having a weird situation here.

I have one external disk with two partitions, and i am sharing both of it.

The two shares are mounted fine in osmc, i can access the files perfectly, but in windows 8.1 i can’t access the two shares it at the same time.

I only access one or the other. I if access the share1 in first i can’t access share 2 then or vice-versa. I keeps asking for username and password on the unacessible share.

The permissions are equal on the osmc file system

Any help please.

This is my samba-shares files

[3.5-Media-Movies]
comment = 3.5-Media-Movies
path = /media/3.5-Media-Movies/
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

[3.5-Media-Series]
comment = 3.5-Media-Series
path = /media/3.5-Media-Series/
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

I also notice this on windows

Thanks

This is wrong, I believe /media is owned by osmc:osmc and the user osmc is not part of the group users

Why didn’t you just use the installation of Samba Server from App Store

Specifying valid and force users won’t break Samba. I agree, a simple installation from the “App Store” is usually better, but it doesn’t suit everyone’s needs. On my (installed just a few days ago) “rPi” OSMC box, the owner and permissions are root:root, 755, so anyone in the “users” group will still be able to access the directory - you can see it’s similar on @tyto’s setup as the “Windows Permissions” dialogue box is showing “root” and “root”. Whether or not “osmc” owns the share is irrelevant; those directives control CIFS access to the share, not permissions within the share (including its’ root) [[Correction - As @fzinken quite correctly then pointed out, the “force user” is to do with creation of objects within the share, but the point is it won’t be affecting @tyto’s access to the share as he’s apparently not getting that far yet]].

However, if I can refer @tyto to “/media/README” …

` …
This directory is for automounted drives. Empty directories here are purged on reboot.

If you wish to configure an /etc/fstab mount for a drive that is attached permanently, you should do so in the /mnt directory`

So how have your partitions got to be under “/media/” - did you get OSMC to mount them, or have you manually added them to “/etc/fstab” yourself? If the latter, you’re going to wind up in an argument with the automounter which will not end well for anybody … If you mounted them manually then try mounting them (and sharing from) somewhere else.

Also …

Have you changed the workgroup (default is, IIRC, “WORKGROUP”)? Life will be a lot easier if that matches what is also set on your “Windows 8.1” machine (open “Explorer”, right-click “My Computer” and look at the properties). As you seem familiar with Samba, it may be you’ve previously changed your PC workgroup to something other than the default and maybe forgotten to set Samba to match.

CIFS (Samba etc.) is a truly horrendous protocol. If you have something like a “Windows Home Server” on your network, install “Client for NFS” on there, share the partitions via NFS, mount them on the “Windows Home Server”, and re-share as windows shares. That, whilst hardly the most efficient approach, will generally out-perform directly accessing via Samba, unless you have an extremely well tuned CIFS network - that way, the windows share (CIFS) is being shared by Windows itself, which does tend to play a bit more nicely with a “Windows” desktop machine.
Of course, that assumes you have a “Windows Home Server” (or equivalent) to perform the NFS/CIFS gateway for you …

When you configured Samba, did you specify a WINS server? If not, and if your “Windows 8.1” PC is also sharing drives, tell Samba the PC is the local WINS server. That will help Samba considerably, though it shouldn’t be the source of your particular problem. If you don’t have sharing enabled on the PC, do so, then point Samba at it for the WINS server (unless you have something better already performing that task, such as another Samba box configured to run a WINS server, or a “Windows Server” box).

Also, have you tried unmapping the drives, then re-mapping them again, making sure you tick the “Use different credentials” box and then supplying the credentials you wish to use to access the share? You may very well find that simply doing that resolves it for you.

Sounds like you know what you talk about, but I suggest your read up:
“The force user and force group directives are also added to enforce the ownership of any newly placed files specified in the share.” from 14.3.  Samba Server Types and the smb.conf File Red Hat Enterprise Linux 4 | Red Hat Customer Portal

1 Like

Yes, I know what force user does :wink:

It won’t be causing @tyto’s problem, because he can’t access the share, so he won’t be creating any files or directories, so they won’t be forced to be created group “users”. I assume he has reasonable knowledge of Samba to even consider touching any of the options, so although personally I never use “force user” (that in itself can cause a whole load of obscure problems and there are always better ways to achieve the same effect; ACLs for example) I’m hoping @tyto actually has a specific, good, reason for setting that option. If he has, I do hope the user he’s trying to access the shares as isn’t the “osmc” user or, as you quite correctly pointed out, that’s not going to get him anywhere (because access to the share will be denied, because “osmc” isn’t in “users”). Plus, of course, the user he has picked (if he wants to write to the shares as well as read from them) will need write access to the mount points below “/media/”, which means being “root” or being in group “root” …

So thinking about it, @tyto, what username are you trying to use to access the share?

Of course, if he doesn’t, and just set it “because I read it somewhere …”, then this conversation isn’t going to go anywhere much very fast :slightly_smiling:

1 Like

Oh, and for reference of anyone trying to do anything like this:

a) If you don’t already understand Samba, don’t try and do anything you can’t do through the standard, supplied, supported tools :slightly_smiling:
b) If you want to spend a few days lost reading about Samba, see The official Samba documentation here - the RHEL documentation mentioned is a little out-of-date (and second-hand anyway - Dead Rat largely bulk copy the official Samba documentation for their documentation).

Hope that helps - obviously do please let everyone know how you get on (curiosity, and all that) …

Hello,

Thanks for the replies. I didn’t read the answers yet, this is

I used the samba instalation from the store.
The weird thing is that i have already acessed the two shares. But imagine start my computer Windows 8.1, acess share 1 insert credentials, is fine. On share 2 is denied.

After that restart again, acess share 2 insert credentials, is fine. On share 1 is denied.

In osmc i can acess the two shares via ssh or gui with no problems

I’m using an account created for the purpose

I followed this tutorial

Can I ask what is wrong with the default automounter permissions and automatically added Samba shares for external drives, and whether you tried it before trying to manually add your own shares ?

A lot of work was put into working out the best set of automount permissions by default both here:

And here:

Unless you really know what you are doing and understand the intricacies of how unix file permissions work on non-unix file systems, (eg mounting FAT/NTFS drives on linux) how Samba deals with those permissions and how it translates those to windows permissions, you are much better off simply letting our automounter and automatic share creation do its thing…

The symptom you see where you can only connect to the first share you try and not the second is almost certainly due to you using different login credentials for the different shares - you cannot connect to the same server using two different sets of login credentials at the same time (this is a windows limitation) so you cannot set up shares with two different sets of valid usernames and expect it to work.

One of the shares is probably an automount share, which as set in the template, only allows the osmc user to connect. If you connect to your manually created share using a different user account you will then not be able to connect to the first share that only allows the osmc user.

2 Likes

Hello,

I just reinstall osmc again and, from what i can see, only installing Samba from the App Store doesn’t make my external hard drive acessible via windows.

Only home folder is available! Should i mount my external drive on the home folder?

sudo mount -t auto /dev/sda1 /home/osmc/media/3.5-Media-Movies

Well you could do it that way but as we said just stick with the standard! Don’t put it in your fstab at all let OSMC mount it automatically (under /media) and you will be able to access it.

Hello,

I just want to acess my external drives from Windows nothing more, without having to mount it all the time

Thanks

And we are just telling you how to do that! Don’t touch any configuration and just attach your harddisk (without touching fstab) and install Samba Server from App Store (without touching smb.conf) and you are done.

I think its clear at least for me that just install samba doesn’t make the drives acessible from Windows.

Have you rebooted both devices since installing?

Since the Samba update from debian main, my external drives stopped show up. Had to make manual share to get em to show up. Only osmc home directory was visible since the smb update, the one that required a confirmation and made alot of ppl upset.

Did you reboot after you installed Samba ?

If you still do not see your external drive as a share after rebooting please post your system journal so we can see why.

You’re the first to report this. External drives show up just fine on my installation.

Please post a copy of your /etc/smb/samba.conf and also a system journal.

Must have been me mounting the drives in fstab to /mnt folder, around the same time as the update, insted of letting automount handle it. As I remember it i did that cuz of them not showing up when connecting to the pi from windows, now i use fstab cuz i have two hdds and they change sda/b as they feel like it so i mount via label to get them to the same mountpoint in the system all the time.

I tried with a pendrive now and it showed up.

Sorry to waste your time.

Hello,

After a clean install of osmc and after installing Samba i rebooted both machines and i was able to access my external drives.

What torrent client you suggest? Is deluged available on the store?

Thanks.