New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set the SMB protocol #53
Comments
Try adding these lines to the [global] section of you smb.conf (on the server you have php smbclient installed): Then retry connecting. |
I added the settings that you suggested and even restarted the server. I still couldn't even see the shared folder. I am using smbclient 4.1.12 on CentOS 7.1 64bit. The smbclient command failed too. Once I added -mSMB3 to the smbclient command I saw folder information. I just want to be able to do something like that for the php smbclient library. |
I will take a look, and see what command-line smbclient is using, and have an idea of how easy it would be to implement. |
Bump! I'd also like to have an option to set the min and max protocols for the connection. I need to force a SMB2 protocol to connect correctly to a server, otherwise there are issues with the target SMB server (this also happens with the smbclient binary, so it isn't an issue with this library) Setting the client min and max protocols in the smb.conf file is fine as a workaround (it's working fine with this library also), but this will likely affect to connections to other servers, which is something I'd like to avoid. |
@jvillafanez do you able to browse SMB2/SMB3 in you PHP app? I use Nextcloud 12 and php-smbclient from PECL on Ubuntu 16.04.2. I could not browse SMB2/SMB3 on Windows with joined Domain but I could browse the shared folder using smbclient CLI though. Both of below commands work though: Due to recent WannaCry vulnerability, most Windows machines disabled SMBv1. Looking forward for this SMB2/3 protocol be implemented in future php-smbclient. Thanks for the work @eduardok :) |
it works in ownCloud ¯_(ツ)_/¯ . No problems browsing with SMB2 protocol. |
From looking at the code, the |
@aklomp it isn't that option. |
@jvillafanez You're right, after some digging around this seems to be the option you're talking about. It's in a Samba4 library that handles commandline option parsing. Searching on the string Fact is that the libsmbclient header hasn't been updated in a long time and doesn't have any hooks through which to set the protocol version (which sort of ends the discussion on this issue as far as this project is concerned, since we can only use what libsmbclient provides). If the other Samba stuff uses libcli features, and libcli is being actively developed, then we're probably a generation behind. Hmm. |
For my understanding this problem is not resolved, and the module is not compatible with SMB v2/v3, right ? |
I am running into the same issues, so I would tend to agree the issue is not resolved. If it was, I haven't been able to find the proper steps for working around it. Anybody have anything? |
Nope for us, we don't use anymore with tool. |
Hi all, I ran into the same issue when trying to mount an external file storage into Nextcloud. I found out I was able to get php-smbclient to negotiate using SMB2+ by adding
Note that you should use |
What @urbenlegend said is correct. On FreeBSD I added those two lines to /usr/local/etc/smb4.conf This was with nextcloud 13.0 RC1 and samba 4.6.12 installed. |
Hi All, I really, REALLY want to get this working, but still having the same issues after adding "client max protocol = SMB3" to the smb.conf on CentOS NC 12.0.4 server. Did you make any other changes to get it to work? Am I modifying the wrong file? (/etc/samba/smb.conf)? I tried restarting Samba, as well as a full server reboot after making the change. Thanks! |
I'd try to also "set client min protocol = ..." depending on the samba version it might use older protocol versions by default and needs to be forced to user higher versions. But that's just a guess. That's what I'd try next. |
I tried adding both of those options with absolutely no effect. I did finally solve it though... I ended up having to add remi-stable repo, install php71-php-smbclient and libsmbclient-devel. I then installed 'smbclient' via pecl. Added 'extension=smbclient.so' to php.ini, rebooted and BAM! my SMB's mounted when I logged into NextCloud. Here are the steps I took for anyone else having the problem. I am running Centos 7 with PHP7.1:
Maybe some of this was unnecessary, and maybe someone who knows this stuff better than me can comment, but hell, it's working now. |
@protocol6v the steps you are totally wrong: you mix php71w (webatic) packages and php71-php one (scl from my repo) and sources build (pecl install). Simply follow the Wizard instructions |
Thanks Remi, i'll give that a try on my next build. I've tried so many things to get this working, and nothing from one place seemed to do the trick. Also, the SMB mounts in NC12 now seem SIGNIFICANTLY faster with what I did than they previously did in NC11. I hope this holds true with your (correct) solution. Will report back once i test. |
Let me remind everyone that this is the libsmbclient-php issue tracker, not ownCloud nor nextcloud ones. Nobody cares about what apps above the library are doing. You have #53 (comment) as a workaround for the problem until we get a proper solution, which given the explanations I doubt it comes (that's how it is, no hard feelings), so I guess this can be closed as "won't fix" or "out of scope" |
@eduardok Don't you mean client min protocol = LANMAN2 |
I've had similar problems in Ubuntu 16.04 using NC 16.
After adding the following code to my
(note: SMB2 may possible be changed to LANMAN2 as well not sure) |
From libsmbclient's manual page: "When libsmbclient is invoked by an application it searches for a directory called .smb in the $HOME directory that is specified in the users shell environment. It then searches for a file called smb.conf which, if present, will fully over-ride the system /etc/samba/smb.conf file. If instead libsmbclient finds a file called ~/.smb/smb.conf.append, it will read the system /etc/samba/smb.conf and then append the contents of the ~/.smb/smb.conf.append to it." The server can force it via (example):
But the client should ideally just match it via (example):
Because of that option (config files), I don't believe anything needs to be changed on php-smbclient, but I've introduced smbclient_client_protocols, see branch issue53: a25e600 |
I have filed an issue but have overseen this one, see #77 Please add this feature quickly (and provide it also via pecl), it is needed a lot. As a reason for having it, imagine the situation where you have one (or a view) older smb fileservers and some new ones. This situation has a deadlock. When setting in smb.conf the |
I've just released v1.0.2 via PECL, that introduces smbclient_client_protocols($state, 'min protocol', 'max protocol'), where you can call it like:
or
Took a leap of faith and set it as a stable release after some manual tests and tcpdump'ing. |
I think it could be useful to also allow to set these values in context for stream users So, see PR #78 |
Our organization has shutdown the use of SMB protocol (version) 1.0. Is there a way to force php smbclient to use a different protocol such as 2.0, 2.1, or 3.0?
The text was updated successfully, but these errors were encountered: