SMB_OC not passing domain through to samba share auth
smb_oc is passing through the username, but not the domain for the smb shares. See: https://github.com/owncloud/core/blob/89db2a027701503ea758380b20b10ca7f5a244d9/apps/files_external/lib/smb_oc.php#L40
This causes mapping of external samba shares using domain authentication to fail.
Example of failed login:
session setup failed: NT_STATUS_LOGON_FAILURE params(-d 0 '//files.yourdomain.com/shared' -c 'ls') at /var/www/owncloud/apps/files_external/3rdparty/smb4php/smb.php#201
This is caused by trying to map the share named 'shared' with username rather than domain\username
hacking smb_oc.php to hard code the domain infront of the username fixes the issue, but obviously this needs to be added into the code properly.
"user" => "mydomain\\$user",
My suggestion is to add the option to allow users to specify the domain they wish to prepend to smb users.
I am happy to provide testing if some code is provided?
cc/ @Xenopathic @PVince81
FIY: you can pass domain to smb server using [email protected]
But how do you do that automatically for all users? Can you just use 'username' and it uses the logged in users username?
Sam McLeod @s_mcleod[https://twitter.com/s_mcleod]
On Fri, 16 Jan 2015, at 09:50 AM, Sergei Shuykov wrote:
FIY: you can pass domain to smb server using [email protected]
Reply to this email directly or view it on GitHub: https://github.com/owncloud/core/issues/13407#issuecomment-70177763
Sorry i misunderstood your point, are users mapped using ldap backend?
Yes that's correct. It doesn't seem to prepend the (correct?) domain for samba mappings.
i just imagined that it would be cool to add checkbox 'use user ldap domain'. i've configured on my OC8 to use ldap and smb, will try to make pr, at least with domain field
Odd, I've never needed a domain component to mount SMB shares, I've always done it with the raw username. Still, it's well documented that usernames can have that format. I don't think LDAP is the way to go about it (it doesn't have a 'NetBIOS domain' property AFAIK), but a simple new field in the configuration would do the trick.
When you have SAMBA4 and its setup as a fledged AD replacement domain file server you need the client to pass the domain with the username.
Sam McLeod @s_mcleod[https://twitter.com/s_mcleod]
On Fri, 16 Jan 2015, at 07:51 PM, Robin McCorkell wrote:
Odd, I've never needed a domain component to mount SMB shares, I've always done it with the raw username. Still, it's well documented that usernames can have that format. I don't think LDAP is the way to go about it (it doesn't have a 'NetBIOS domain' property AFAIK @blizz), but a simple new field in the configuration would do the trick.
Reply to this email directly or view it on GitHub: https://github.com/owncloud/core/issues/13407#issuecomment-70224658
@sammcj Not for all setups then, I use Samba 4 and don't need the domain component :see_no_evil:
Are your users part of a domain, or just locally authenticated?
Sam McLeod @s_mcleod[https://twitter.com/s_mcleod]
On Fri, 16 Jan 2015, at 07:56 PM, Robin McCorkell wrote:
@sammcj Not for all setups then, I use Samba 4 and don't need the domain component :see_no_evil:
Reply to this email directly or view it on GitHub: https://github.com/owncloud/core/issues/13407#issuecomment-70225061
Please do not include me in these threads.
Sent from my Verizon Wireless 4G LTE smartphone
— Reply to this email directly or view it on GitHub.
@blizzz
@sammcj could you try changes from this https://github.com/Sugaroverdose/core/commit/c438caa83fa07ff0ba4229b0f5f651c3c74f3c2c commit? i've installed test OC7 on ubuntu 14.04 and smbclient from it's repo doesn't need to specify domain when connects to SMB as @Xenopathic said, so this should work, but i can't guarantee :)
@Xenopathic, @Sugaroverdose is the Sugaroverdose@c438caa patch going to be merged into master? I already needed that feature to connect from a Linux server to a Windows file server. In my case I implemented the feature by myself... but if the work is already done in master would be better :)
Additionally, what's the point of the "Use username as share" option if, if I'm not wrong, using "/$user" as share would do the trick?
i didn't create pr for https://github.com/Sugaroverdose/core/commit/c438caa83fa07ff0ba4229b0f5f651c3c74f3c2c, as i said - i can't test it. If you have same issue and commit solves it - i'll make pr.
PS: in 8.1 this issue may be fixed by #10673
I have tested the Sugaroverdose@c438caa commit on a unmodified OC 7.0.4 installation.
I confirm that it works and it also solves my problem.
It would be great if you make PR to integrate it. Thanks!
@abelgomez Your point about "Use username as share" is a good one - there is little point for it. However, there is currently no intuitive feedback about the placeholders available for the fields.
With regards to @Sugaroverdose 's patch - that assumes the domain separator is a ;. I've seen many cases where the separator is /, \ or even +. Perhaps a better solution would be a "Username prefix" field, that is simply prepended to the username? We can discuss it more in a PR :smile:
@Xenopathic smb4php(current backend) parses url by itself, after that, it generates command for smbclient and it does support ';' so my changes shouldn't brake anything :)
Given that the discussion has emerged, please let me give you my opinion:
It's true that there's no intuitive feedback about the placeholders, and they are not even mentioned in the GUI documentation. But, although the doc for the external storage using a config file gives some hints, adding the "Username as share" option led me to think that there was no support for placeholders. I even ended up doing my own implementation for placeholders.
Maybe I'm just dumb, but maybe it would be better just to improve the documentation or add some kind of hint in the configuration form.
@abelgomez That's precisely what I was thinking :smile: I thought about adding a Tipsy (or when the migration happens, a Bootstrap tooltip) to the currently focussed field showing the placeholders it supports.
@icewind1991 I guess this was fixed with the latest update to your smb lib 1.0.4 - right?