External SMB Share - Exception: Unknown error

Hi!

I have a new installation running on Ubuntu 20.04.

I’m trying to setup a connection to an external SMB (Windows Server 2016). I have installed smbclient. PHP smbclient module isn’t avaliable on Ubuntu 20.04 as I understand.

The documentation states: “The PHP smbclient module is preferred, but either will work.”
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage/smb.html

This works fine in the terminal:
smbclient \\\\server.local.domain\\Share -U username%password

But when I enter the same information in NextCloud I get an exception shown in Admin - Logging.

Icewind\SMB\Exception\Exception: Unknown error (NT_STATUS_OBJECT_NAME_INVALID) for /
/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php - line 49:
Icewind\SMB\Exception\Exception::unknown()
/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php - line 92:
Icewind\SMB\Exception\Exception::fromMap()
/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 471:
Icewind\SMB\Wrapped\Parser->checkForError()
/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 215:
Icewind\SMB\Wrapped\Share->parseOutput()
/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php - line 193:
Icewind\SMB\Wrapped\Share->stat()
/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php - line 345:
OCA\Files_External\Lib\Storage\SMB->getFileInfo()
/var/www/nextcloud/lib/private/Files/Storage/Common.php - line 458:
OCA\Files_External\Lib\Storage\SMB->stat()
/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php - line 722:
OC\Files\Storage\Common->test()
/var/www/nextcloud/apps/files_external/lib/MountConfig.php - line 215:
OCA\Files_External\Lib\Storage\SMB->test()
/var/www/nextcloud/apps/files_external/lib/Controller/StoragesController.php - line 274:
OCA\Files_External\MountConfig::getBackendStatus("*** sensiti ... *")
/var/www/nextcloud/apps/files_external/lib/Controller/GlobalStoragesController.php - line 188:
OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensiti ... *")
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 218:
OCA\Files_External\Controller\GlobalStoragesController->update("*** sensiti ... *")
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 127:
OC\AppFramework\Http\Dispatcher->executeController()
/var/www/nextcloud/lib/private/AppFramework/App.php - line 157:
OC\AppFramework\Http\Dispatcher->dispatch()
/var/www/nextcloud/lib/private/Route/Router.php - line 302:
OC\AppFramework\App::main()
/var/www/nextcloud/lib/base.php - line 993:
OC\Route\Router->match()
/var/www/nextcloud/index.php - line 37:
OC::handleRequest()

Please advice me. Can I use the PHP module in any way? Do I need to?
Thanks!

EDIT:

When entering a faulty username/password I get another error:
OCP\Files\StorageAuthException: Storage unauthorized. Invalid login

So, some kind of communication with the SMB server are made… :slight_smile:

1 Like

Hello mate, hope you are doing well…

Do you the following installed?

php-smbclient.x86_64 php74-php-smbclient.x86_64 libsmbclient.x86_64 php-icewind-smb.noarch

Also, if you have Selinux enabled, you need to run this:

setsebool -P httpd_use_cifs on

Hope this helps, good luck!

:smiley:

Thanks, but…

I’m on Ubuntu 20.04, it seems like some of the packages are missing in the apt catalog:

php-smbclient
php74-php-smbclient
php-icewind-smb

libsmbclient was already installed earlier.

I don’t have Selinux (yet, so thanks!) :slight_smile:

Where to look for the packages?

EDIT:
I have found some resource here. But have not tried to add another repo yet.
https://dannyda.com/tag/ubuntu-20-04-1-lts-php-smbclient/

1 Like

Hey there, that’s nice to hear.

So, did you try to run:

apt-cache search smb

To see what can be relevant for your server?

$ apt-cache search smb

backuppc - high-performance, enterprise-grade system for backing up PCs
cifs-utils - Common Internet File System utilities
dmidecode - SMBIOS/DMI table decoder
freeradius-utils - FreeRADIUS client utilities
gvfs-backends - userspace virtual filesystem - backends
libnss-winbind - Samba nameservice integration plugins
libpam-mount - PAM module that can mount volumes for a user session
libpam-mount-bin - PAM module that can mount volumes for a user session - helper
libpam-winbind - Windows domain authentication integration plugin
libsmbclient - shared library for communication with SMB/CIFS servers
libsmbclient-dev - development files for libsmbclient
libsmbios-c2 - Provide access to (SM)BIOS information -- dynamic library
libsmbios-dev - Provide access to (SM)BIOS information - development files
libsmbios-doc - Access to (SM)BIOS information in an OS-indepent way (docs)
libuutil1linux - Solaris userland utility library for Linux
libwbclient-dev - Samba winbind client library - development files
libwbclient0 - Samba winbind client library
python3-samba - Python 3 bindings for Samba
resource-agents - Cluster Resource Agents
samba - SMB/CIFS file, print, and login server for Unix
samba-common - common files used by both the Samba server and client
samba-common-bin - Samba common files used by both the server and the client
samba-dev - tools for extending Samba
samba-dsdb-modules - Samba Directory Services Database
samba-libs - Samba core libraries
samba-vfs-modules - Samba Virtual FileSystem plugins
smbclient - command-line SMB/CIFS clients for Unix
tcpdump - command-line network traffic analyzer
winbind - service to resolve user and group information from Windows NT servers
argonaut-samba - Argonaut scripts to generate Samba share configurations
cadaver - command-line WebDAV client
cp2k - Ab Initio Molecular Dynamics
fonts-noto-extra - "No Tofu" font families with large Unicode coverage (extra)
fonts-noto-ui-extra - "No Tofu" font families with large Unicode coverage (UI extra)
forensics-all - Debian Forensics Environment - essential components (metapackage)
forensics-extra - Forensics Environment - extra console components (metapackage)
fusesmb - filesystem client based on the SMB file transfer protocol
gadmintools - GTK+ server administration tools (meta-package)
gatling - high performance web server and file server
hydra - very fast network logon cracker
hydra-gtk - very fast network logon cracker - GTK+ based GUI
jftp - Java GUI client for FTP, SMB, SFTP and NFS
kio - resource and network access abstraction
krusader - twin-panel (commander-style) file manager
ldapscripts - Add and remove users and groups (stored in a LDAP directory)
ledgersmb - financial accounting and ERP program
libauthen-simple-perl - simple and consistent perl framework for authentication
libauthen-simple-smb-perl - Simple SMB authentication
libauthen-smb-perl - SMB authentication module for Perl
libbiojava-java - Java API to biological data and applications (default version)
libbiojava4-java - Java API to biological data and applications (default version)
libcrypt-smbhash-perl - generate LM/NT hash of a password for samba
libfilesys-smbclient-perl - perl interface to access Samba filesystem
libjcifs-java - Java library for the CIFS/SMB networking protocol
libjcifs-java-doc - Documentation for libjcifs-java (CIFS/SMB library for Java)
libkf5kio-dev - resource and network access abstraction (development files)
libkf5kio-doc - resource and network access abstraction (documentation)
libkf5kiocore5 - resource and network access abstraction (KIO core library)
libkf5kiofilewidgets5 - resource and network access abstraction (KIO file widgets library)
libkf5kiogui5 - resource and network access abstraction (KIO gui library)
libkf5kiontlm5 - resource and network access abstraction (KIO NTLM library)
libkf5kiowidgets5 - resource and network access abstraction (KIO widgets library)
libparse-dmidecode-perl - interface to SMBIOS using dmidecode
libpgobject-simple-perl - minimalist stored procedure mapper based on LedgerSMB's DBObject
librust-chrono+wasmbind-dev - Date and time library for Rust - feature "wasmbind"
lsmbox - List number of total/unread messages for mailboxes
monitoring-plugins-standard - Plugins for nagios compatible monitoring systems (standard)
ncrack - High-speed network authentication cracking tool
netatalk - Apple Filing Protocol service
netatalk-dbg - Apple Filing Protocol service - debug symbols
patator - Multi-purpose brute-forcer
python3-impacket - Python3 module to easily build and dissect network protocols
python3-libsmbios - Provide access to (SM)BIOS information -- Python libraries
python3-smbc - Python 3 bindings for the Samba client library
python3-smbus - Python 3 bindings for Linux SMBus access through i2c-dev
registry-tools - tools for viewing and manipulating the Windows registry
samba-testsuite - test suite from Samba
slapd-contrib - contributed plugins for OpenLDAP slapd
slapd-smbk5pwd - transitional package for slapd-contrib
smb-nat - Netbios Auditing Tool
smb2www - SMB/CIFS network client with a web interface
smb4k - Samba (SMB) share advanced browser
smbc - samba-commander - curses based samba network browser
smbios-utils - Provide access to (SM)BIOS information -- utility binaries
smbldap-tools - Scripts to manage Unix and Samba accounts stored on LDAP
smbmap - handy SMB enumeration tool
smbnetfs - User-space filesystem for SMB/NMB (Windows) network servers and shares
snort - flexible Network Intrusion Detection System
snort-common - flexible Network Intrusion Detection System - common files
snort-common-libraries - flexible Network Intrusion Detection System - libraries
snort-doc - flexible Network Intrusion Detection System - documentation
snort-rules-default - flexible Network Intrusion Detection System - ruleset
ssvnc - Enhanced TightVNC viewer with SSL/SSH tunnel helper
tuxcmd-modules - VFS modules for tuxcmd file manager
xmms2-plugin-smb - XMMS2 - Server Message Block (SMB) transport

Cant find anything that looks like the mentioned packages.

Ok, finally I solved this by doing:
pecl install smbclient

Maybe it’s caused by removed package from the Ubuntu 20.04 default feed.

1 Like

Perfect mate, good job!

Congratulations!

Have a nice week.

:smiley:

1 Like

Thanks, and have a good week!

I then come across the bug in the icewind:

But I have patched the php-file manually as a workaround. :slight_smile:

1 Like

Maybe similar issue as mine?
I also faced an Icewind bug, causing files >8MB to fail.