{"id":44033661,"url":"https://github.com/sahlberg/libsmb2","last_synced_at":"2026-02-07T19:36:42.098Z","repository":{"id":15399261,"uuid":"78067447","full_name":"sahlberg/libsmb2","owner":"sahlberg","description":"SMB2/3 userspace client","archived":false,"fork":false,"pushed_at":"2026-01-25T13:00:03.000Z","size":2607,"stargazers_count":388,"open_issues_count":11,"forks_count":175,"subscribers_count":17,"default_branch":"master","last_synced_at":"2026-01-26T04:51:34.294Z","etag":null,"topics":["cifs","client","filesystems","smb"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sahlberg.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-01-05T01:26:42.000Z","updated_at":"2026-01-25T13:00:09.000Z","dependencies_parsed_at":"2026-01-25T15:00:58.778Z","dependency_job_id":null,"html_url":"https://github.com/sahlberg/libsmb2","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/sahlberg/libsmb2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahlberg%2Flibsmb2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahlberg%2Flibsmb2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahlberg%2Flibsmb2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahlberg%2Flibsmb2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahlberg","download_url":"https://codeload.github.com/sahlberg/libsmb2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahlberg%2Flibsmb2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29205353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T17:44:10.191Z","status":"ssl_error","status_checked_at":"2026-02-07T17:44:07.936Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cifs","client","filesystems","smb"],"created_at":"2026-02-07T19:36:41.591Z","updated_at":"2026-02-07T19:36:42.090Z","avatar_url":"https://github.com/sahlberg.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Libsmb2 is a userspace client/server library for accessing or serving\nSMB2/SMB3 shares on a network.\nIt is high performance and fully async. It supports both zero-copy\nfor SMB READ/WRITE commands as well as compounded commands.\n\nLibsmb2 is distributed under the LGPLv2.1 licence.\n\n\nAPI\n===\nLibsmb2 implements three different APIs for accessing remote SMB shares :\n\n1, High level synchronous posix-like API:\nThis is a simple API for accessing a share.\nThe functions in this API are modelled to be be similar to the corresponding\nPOSIX functions.\nThis API is described in libsmb2.h\n\n2, High level async posix-like API:\nThis is a high performance, fully non-blocking and async API.\nThe functions in this API are modelled to be be similar to the corresponding\nPOSIX functions.\nThis is the recommended API.\nThis API is described in libsmb2.h\n\n3, Low level async RAW API:\nThis is a low level API that provides direct access to the SMB2 PDUs\nand data structures.\nThis API is described in libsmb2-raw.h\n\nLibsmb2 implements a synchronous API for running an SMB server. You could\nrun an async server if you implement the main loop yourself however\n\nSMB URL Format\n==============\nThe SMB URL format is currently a small subset of the URL format that is\ndefined/used by the Samba project.\nThe goal is to eventually support the full URL format, thus making URLs\ninterchangeable between Samba utilities and Libsmb2 but we are not there yet.\n\nsmb://[\u003cdomain\u003e;][\u003cuser\u003e@]\u003cserver\u003e[:\u003cport\u003e]/\u003cshare\u003e[/path][?arg=val[\u0026arg=val]*]\n\n\u003cserver\u003e is either a hostname, an IPv4 or an IPv6 address.\n\nArguments supported by libsmb2 are :\n sec=\u003cmech\u003e    : Mechanism to use to authenticate to the server. Default\n\t         is any available mech, but can be overridden by :\n\t\t krb5: Use Kerberos using credentials from kinit.\n\t\t krb5cc: Use Kerberos using credentials from credentials\n\t                 cache.\n\t\t ntlmssp : Only use NTLMSSP\n vers=\u003cversion\u003e : Which SMB version to negotiate:\n                  2: Negotiate any version of SMB2\n                  3: Negotiate any version of SMB3\n\t\t  2.02, 2.10, 3.00, 3.02, 3.1.1 : negotiate a specific version.\n\t\t  Default is to negotiate any SMB2 or SMB3 version.\n  seal          : Enable SMB3 encryption.\n  sign          : Require SMB2/3 signing.\n  timeout       : Timeout in seconds when to cancel a command.\n                  Default it 0: No timeout.\n  ndr32         : DCERPC: only offer NDR32 transfer syntax. (default)\n  ndr64         : DCERPC: only offer NDR64 transfer syntax.\n  ndr3264       : DCERPC: offer both NRD32 and NDR64 transfer syntax.\n  le            : DCERPC: send PDUs in Little-Endian format\n  be            : DCERPC: send PDUs in Big-Endian format\nNOTE:-\n\tWhen using krb5cc mode use smb2_set_domain() and smb2_set_password() in the examples and applications\n\nSMB Server\n==========\nThere is an example server implementation in examples/smb2-server-sync.c. The library\nserver function is handed an array of function pointers that the library will call\nfor each client command. It is up to your implementation to fill out and return\nreplies for each according to your use. The example simulates a disk with a few files.\nYour handler will be also be called to pre-authenticate users as part of ntlmssp (krb\nauthenticaton not yet implemented). Your application will also be called-back each\ntime a client connect to allow your to configure the context prior to negotiation.\n\nAuthentication\n==============\nLibsmb2 provides has builtin support for NTLMSSP username/password\nauthentication.\nIt can also, optionally, be built with (MIT) Kerberos authentication.\n\nLibsmb2 will try to build with Kerberos if these libraries are present.\nYou can force a build without Kerberos support by using the flag\n--without-libkrb5 to configure. In this case only NTLMSSP authentication\nwill be available.\n\nMIT KERBEROS\n============\nAuthentication is implemented using MIT Kerberos and it supports both KRB5\nfor authentication against Active Directory as well as NTLMSSP (optional).\n\nMIT Kerberos can be configured to also provide NTLMSSP authentication,\nas an alternative to the builtin NTLMSSP implementation using an\nexternal mech plugin.\nTo use this Kerberos/NTLMSSP module you will need to build and install\nGSS-NTLMSSP from [https://github.com/simo5/gss-ntlmssp]\nIf you are uncertain you can skip this module and just use the NTLMSSP\nmodule that is provided by libsmb2.\n\nNTLM Authentication\n-------------------\nNTLM credentials are stored in a text file of the form :\nDOMAIN:USERNAME:PASSWORD\nwith one line per username.\nYou need to set up the environment variable NTLM_USER_FILE to point to this\nfile.\nYou need one entry in this file for each local user account you want to be able\nto use libsmb2 for accessing a remote share.\n\nBy default, NTLM authentication will use the username for the current process.\nThis can be overridden by specifying a different username in the SMB URL :\n  smb://guest@server/share?sec=ntlmssp\n\nKRB5 Authentication\n-------------------\nKerberos authentication can be used when the linux workstation as well as\nthe file server are part of Active Directory.\n\nYou should be able to authenticate to the file server using krb5\nby specifying sec=krb5 in the URL :\n  smb://server/share?sec=krb5\n\nThe application needs to set the username, password and the domain fqdn in the context using\nsmb2_set_user(), smb2_set_password() and smb2_set_domain() respectively.\n\n\nNTLM Credentials\n================\nThis applies to both the builtin NTLMSSP implementation as well as when\nusing Kerberos with the NTLMSSP mech plugin.\n\nNTLM credentials are stored in a text file of the form :\nDOMAIN:USERNAME:PASSWORD\nwith one line per username.\nYou need to set up the environment variable NTLM_USER_FILE to point to this\nfile.\nYou need one entry in this file for each local user account you want to be able\nto use libsmb2 for accessing a remote share.\n\nBy default, NTLM authentication will use the username for the current process.\nThis can be overridden by specifying a different username in the SMB URL :\n  smb://guest@server/share?sec=ntlmssp\n\nAlternatively you can provide the username and password from your application\nby calling :\n  smb2_set_user(smb2, \u003cusername\u003e);\n  smb2_set_password(smb2, \u003cpassword\u003e);\n\n(For server, you don't need to set the user, as that is supplied by the client)\n\nSMB2/3 SIGNING\n==============\nSigning is supported with KRB5, with the builtin ntlmssp support and with\ngss-ntlmssp mech plugin.\n\nSMB3 Encryption\n===============\nEncryption is only supported with KRB5 or with the builtin ntlmssp support.\nEncryption is not supported when the gss-ntlmssp mech plugin is used.\nEncryption can be enabled either using the \"seal\" URL argument or by calling\n  smb3_set_seal(smb2, 1);\n\nBUILDING LIBSMB2\n===============\n\n Windows\n---------------------------\n\nYou have to install CMake (https://cmake.org/) and Visual Studio (https://www.visualstudio.com/)\nto build libsmb2 for Windows (including Universal Windows Platform).\n\nPlease follow the next steps to build shared library:\n\n\tmkdir build\n\tcd build\n\tcmake -G \"Visual Studio 15 2017\" ..\n\tcmake --build . --config RelWithDebInfo\n\nStatic library: \n\n\tmkdir build\n\tcd build\n\tcmake -G \"Visual Studio 15 2017\" -DBUILD_SHARED_LIBS=0 ..\n\tcmake --build . --config RelWithDebInfo\n\n macOS, iOS, tvOS, watchOS\n---------------------------\n\nYou can use AMSMB2 (https://github.com/amosavian/AMSMB2) universal framework \nwhich incorporates precompiled libsmb2 for Apple devices.\n\nIt is written in Swift but can be used in both Swift and Objective-C codes.\n\nIf you want to rebuild libsmb2 in AMSMB2, please follow these steps:\n\n\tgit clone https://github.com/amosavian/AMSMB2\n\tcd AMSMB2/buildtools\n\t./build.sh\n\nPrecompiled binaries don't include Kerberos support by default.\nIf you want build libraries with Kerberos support, execute this script instead:\n\n\t./build-with-krb5.sh\n\n\nESP32\n-----\nlibsmb2 is pre-configured for the ESP32 micro-controller using the esp-idf\ntoolchain (Arduino is not supported). Simply clone this project in the\n'components' directory of the ESP32 project and it will automatically be\nincluded in the build process.\n\nRaspberry Pi Pico W (RP2040)\n----------------------------\nlibsmb2 will compile on the RP2040 using gcc-arm-none-eabi, the pico-sdk\nand FreeRTOS-Kernel. In examples/picow is a CMakeLists.txt that can be\nedited to point at the pico-sdk and FreeRTOS-Kernel, and will then build\nlibsmb2 and a sample - this can be used as a starting point.  Inside\ninclude/picow are some configuration files for lwip, FreeRTOS and any\napplications built with libsmb2.  These can also be used as a starting \npoint and adjusted as needed for your applications.\n\nThe only define needed for libsmb2 on the RP2040, other than the RP2040\ndefines such as PICO_BOARD=pico_w, is PICO_PLATFORM.\n\nPlaystation 2\n------------\nEE, Emotion-Engine, is the main CPU for the PS2.\nTo compile libsmb2 for the PS2 EE, first install the PS2 toolchain and\nPS2 SDK and set it up.\n\nTo build libsmb2.a, a version of libsmb2 for the EE tcpip stack:\n  $ make -f Makefile.platform clean\n  $ make -f Makefile.platform ps2_ee_install\n\nEE Using IOP Stack, It´s a different of EE\nversion for when the LWIP stack is running on the IOP (libsmb2_rpc and linking\nwith -lps2ips)\n\nTo build libsmb2_rpc.a, a version of libsmb2 for ee with IOP tcpip stack:\n  $ make -f Makefile.platform clean\n  $ make -f Makefile.platform ps2_rpc_install\n\nIOP, IO-Processor is the secondary CPU for the PS2.\nThe library is been used to build smb2man.irx module but it doesn´t comes with the library installed, To install libsmb2 for the PS2 IOP and smb2man.irx, first install the PS2 toolchain and PS2SDK and set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform clean\n  $ make -f Makefile.platform ps2_iop_install\n  $ make -f Makefile.platform clean  \n  $ make -f Makefile.platform ps2_irx_install\n\nPlayStation 3\n-------------\nPPU, PowerPC, is the main CPU for the PS3.\nTo compile libsmb2 for the PS3 PPU, first install the PS3 toolchain and\nPSL1GHT SDK and set it up.\n\nThen to build libsmb2, run\n  $ cd lib\n  $ make -f Makefile.PS3_PPU install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\nPSL1GHT SDK portlibs folder.\n\nPlayStation Vita\n-------------\nARM® Cortex™ - A9 core (4 core), is the main CPU for the PSVITA.\nTo compile libsmb2 for the PSVITA, first install the VitaSDK using\nvdpm \n\nThen to build libsmb2, run\n  $ make vita_install -f Makefile.platform\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\nVitaSDK libs folder.\n\nPlayStation 4\n-------------\nx86_64 is the main CPU for the PS4.\nTo compile libsmb2 for the PS4 PPU, first install the PS4 toolchain and\nOpenOrbis SDK and set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform ps4_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\nOpenOrbis SDK include folder.\n\nNintendo 3DS\n-------------\nNintendo 3DS CPU is a ARM11 MPCore variant.\nTo compile libsmb2 for the Nintendo 3DS, first install the devkitPro with libctru to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform 3ds_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\ndevkitPro 3ds portlibs folder.\n\nNintendo Switch\n-------------\nNintendo Switch CPU is a Custom Nvidia Tegra X1.\nTo compile libsmb2 for the Nintendo Switch, first install the devkitPro with libnx to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform switch_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\ndevkitPro switch portlibs folder.\n\nNintendo Wii\n-------------\nNintendo Wii CPU is a Broadway PowerPC processor.\nTo compile libsmb2 for the Nintendo Wii, first install the devkitPro with libogc using pacman to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform wii_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\ndevkitPro wii portlibs folder.\n\nNintendo Gamecube\n-------------\nNintendo GameCube CPU is a IBM \"Gekko\" PowerPC CPU.\nTo compile libsmb2 for the Gamecube, first install the devkitPro with libogc using pacman to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform gc_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\ndevkitPro gamecube portlibs folder.\n\nNintendo DS \n-------------\nNintendo DS CPU is both ARM7TDMI and ARM946E-S.\nTo compile libsmb2 for the Nintendo DS, first install the devkitPro with libnds using pacman to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform ds_install\n\nThe process will copy the resulting libsmb29.a and the include/smb2 headers to your\ndevkitPro ds portlibs folder on: lib/arm9.\n\nNintendo WII-U\n-------------\nNintendo Wii-U CPU is a IBM \"Espresso\" PowerPC-based 45 nm, with 4 cores and a clock speed of 1.24 GHz.\nTo compile libsmb2 for the Nintendo WII-U, first install the devkitPro with libwut using pacman to set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform wiiu_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\ndevkitPro wiiu portlibs folder.\n\nAmiga (AmigaOS)\n----------------------\nAmigaOS is Operating system which the main processor is a Microprocessor PowerPC.\nThere are 3 versions:\nAmigaOS4(Makefile.AMIGA)\nAmigaOS3(Makefile.AMIGA_OS3)\nAmigaAROS(Makefile.AMIGA_AROS)\nTo compile libsmb2 for the AmigaOS, you need to set newlib.library V53.40 or newer (or V53.30 as included in 4.1 FE) and \nfilesysbox.library 54.4 or newer to set it up.\n\nThen to build libsmb2, choose the makefile acording your AmigaOS system and hit\n  $ cd lib\n  $ make -f Makefile.YOUR_AMIGA_OS_USED clean install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers in the bin folder inside of the lib folder  \nNOTE: Amiga AROS is a Open Source version of AmigaOS, So do not build this version unless you are using the AmigaAROS.\n\nDreamcast (KallistiOS)\n----------------------\nHitachi SH4 in little-endian mode is the main CPU for the Dreamcast.\nTo compile libsmb2 for the Dreamcast, first install the KOS toolchain and\nand set it up.\n\nThen to build libsmb2, run\n  $ make -f Makefile.platform clean dc_install\n\nThe process will copy the resulting libsmb2.a and the include/smb2 headers to your\nKallistiOS toolchain install location addons folder.\nNOTE: There is not yet a kos-ports entry for libsmb2 but once a versioned release\nthat includes Dreamcast support is created installing from kos-ports will become\nthe preferred method of installation.\n\nXbox (Xbox XDK)\n----------------------\nXbox CPU is a custom Intel Pentium III Coppermine-based processor which only supports litlle endian values.\nTo compile libsmb2 for the Xbox, first install the RXDK from the Team Resurgent.\n\nThen to build libsmb2, go to Xbox folder \nand open the provided .sln file, Then hit the green button to build:\n\nThe process will result a libsmb2.lib. So you can copy the include files\nand the .lib file to your Xbox project.\n\nXbox 360 (Xbox 360 SDK)\n----------------------\nXbox 360 CPU is a PPC(PowerPC) Xenon which only supports only big endian values.\nTo compile libsmb2 for the Xbox 360, first install the Xbox 360 SDK(with all features), Microsoft Visual C++ 2010 Ultimate and Windows XP(Recommended) or Windows 7.\n\nThen to build libsmb2, go to Xbox 360 folder \nand open the provided .sln file, Then hit the green button to build:\n\nThe process will result a libsmb2.lib. So you can copy the include files\nand the .lib file to your Xbox 360 project.\n\nNOTE: Both ports was based on XBMC-360 port by BDC(Brent De Cartet) and now being updated to libsmb2 standards to best performance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahlberg%2Flibsmb2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahlberg%2Flibsmb2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahlberg%2Flibsmb2/lists"}