Can't connect CIFS/SMB Share

Steps to reproduce

When I try to connect the share on the OwnCloud it doesn’t work.
The connection setup looks this way:
Name: Temp
Auth: User name with password
Server address: X.X.X.X (there is an IP)
Share: /Temp
Remote sub: /
Username: myuser
Password: mypass
Allowed for all

Expected behaviour

I want to see my share connected.

Actual behaviour

It doesn’t connect and I see this in my log:
{“reqId”:“XfIUUODNO3o0VYsiylD8gwAAAEg”,“level”:3,“time”:“2019-12-12T13:20:00+03:00”,“remoteAddr”:“Y.Y.Y.Y”,“user”:“Ownadmin”,“app”:“files_external”,“method”:“PUT”,“url”:"/index.php/apps/files_external/globalstorages/1",“message”:“Exception: {“Exception”:“Icewind\\SMB\\Exception\\DependencyException”,“Message”:“No valid backend available, ensure smbclient is in the path or php-smbclient is installed”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/owncloud\/apps\/files_external\/lib\/Lib\/Storage\/SMB.php(88): Icewind\\SMB\\ServerFactory->createServer(‘X.X.X.X’, Object(Icewind\\SMB\\BasicAuth))\n#1 \/var\/www\/html\/owncloud\/lib\/private\/Files\/External\/LegacyUtil.php(204): OCA\\Files_External\\Lib\\Storage\\SMB->__construct(Array)\n#2 \/var\/www\/html\/owncloud\/apps\/files_external\/lib\/Controller\/StoragesController.php(254): OC\\Files\\External\\LegacyUtil::getBackendStatus(’\\\\OCA\\\\Files_Exte…’, Array, false, true)\n#3 \/var\/www\/html\/owncloud\/apps\/files_external\/lib\/Controller\/GlobalStoragesController.php(186): OCA\\Files_External\\Controller\\StoragesController->updateStorageStatus(Object(OC\\Files\\External\\StorageConfig), true)\n#4 \/var\/www\/html\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(153): OCA\\Files_External\\Controller\\GlobalStoragesController->update(1, ‘Temp1’, ‘smb’, ‘password::passw…’, Array, Array, Array, Array, 100, true)\n#5 \/var\/www\/html\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(85): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OCA\\Files_External\\Controller\\GlobalStoragesController), ‘update’)\n#6 \/var\/www\/html\/owncloud\/lib\/private\/AppFramework\/App.php(100): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OCA\\Files_External\\Controller\\GlobalStoragesController), ‘update’)\n#7 \/var\/www\/html\/owncloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main(‘OCA\\\\Files_Exter…’, ‘update’, Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#8 \/var\/www\/html\/owncloud\/lib\/private\/Route\/Router.php(342): OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#9 \/var\/www\/html\/owncloud\/lib\/base.php(920): OC\\Route\\Router->match(’\/apps\/files_ext…’)\n#10 \/var\/www\/html\/owncloud\/index.php(54): OC::handleRequest()\n#11 {main}",“File”:"\/var\/www\/html\/owncloud\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/ServerFactory.php",“Line”:51}"}

Server configuration

Operating system:
CentOS 8
Web server:
Apache 2.4
MariaDB 3.10
PHP version:
ownCloud version: (see ownCloud admin page)
Updated from an older ownCloud or fresh install:
Fresh install
Where did you install ownCloud from:
From Repository to CentOS 8.
Signing status (ownCloud 9.0 and above):

I’m trying to connect CIFS/SMB Share.
I have:
CentOS 8 with apache, samba-client and cifs-utils installed
I can connect to Windows hare This way from the Linux Server: smbclient ‘\X.X.X.X\Temp’ -U username
I see location of the smbclient using: which smbclient or even sudo -u apache
I can’t use php-libsmbclient, because it doesn’t exist under CentOS 8 and can’t be compiled from the sources.

Login as admin user into your ownCloud and access 
paste the results into and puth the link here.

No errors have been found.

No valid backend available, ensure smbclient is in the path or php-smbclient is installed

Install php-smbclient and make sure it’s used by your web server.

1 Like

You haven’t read the post.

I can’t use php-libsmbclient (php-smbclient, libsmb-php depended on OS), because it doesn’t exist under CentOS 8 and can’t be compiled from the sources.

In the same Error we see: “ensure smbclient is in the path”. And it’s in the path: sudo -u apache which smbclient returns: /bin/smbclient

Now I have to force OwnCloud to work with smbclient! And it doesn’t work.

If you don’t have anything valuable in that installation, I’d recommend to use a different linux distribution. Using smbclient from ownCloud isn’t recommended, so you should use the php-libsmbclient library.

Other than that, I’m not sure if sudo does something with the paths. Maybe the path environment variable isn’t changed after the sudo, so what you see is your path and not the one set for apache.
In any case, it’s clear that apache doesn’t find the smbclient.

1 Like

When apache doesn’t see a smbclient in the path (I made this test) it instantly gives this error in storage setup: Please make sure that the app that provides this backend is installed and enabled.

The error somewhere in this part of the code (ServerFactory.php):
public function createServer($host, IAuth $credentials) {
foreach (self::BACKENDS as $backend) {
if (call_user_func("$backend::available", $this->getSystem())) {
return new $backend($host, $credentials, $this->getSystem(), new TimeZoneProvider($host, $this->getSystem()));
throw new DependencyException(‘No valid backend available, ensure smbclient is in the path or php-smbclient is installed’);

It checks available backend or not using ‘while’ in System.php. And it’s available.

By the documentation: smbclient should work fine.

I set up marks in the code.

As I see:

  1. Request comes to line 46 in ServerFactory.php:
    if (call_user_func("$backend::available", $this->getSystem()))

  2. Then request comes to line 26 in Server.php:
    return $system->getSmbclientPath();

  3. Then it should come to line 32 in System.php:
    public function getSmbclientPath()
    It should, but I don’t see any data here. No request to this function at all.

I think that the mistake is here in the first request: $this->getSystem()
Something wrong with data.


i’m not sure how many users of this forums have an idea what those code parts mean. If you think there is an issue within the ownCloud code then i think it would be better to open an issue at so that you could discuss this with the ownCloud developers.

1 Like