| Work in progress This site is in the process of being reviewed and updated. |
smbclient command
| option | description | value below |
|---|---|---|
| {server} | hostname offering service | www.example.com (must by resolvable by hosts file or DNS) |
| {service} | name of the service offered | myshare (an SMB/CIFS share) |
| -U | username | hnelson |
| -W | kerberos realm | EXAMPLE.COM |
| -R | hostname resolution method | host (use hosts file or DNS, skipping WINS and LMHOSTS) |
| -D | initial directory | hnelson |
| -k | use kerberos | |
| -d | set debug logging level | 3 |
Sample session
Note in the following smbclient session that:
- The user is not prompted for a password. Instead, the session uses an existing ticket from the Kerberos ticket cache.
- SPNEGO is used on Microsoft networks to choose between NTLM and Kerberos authentication.
- The Apache KDC is configured with a host principal for host/www.example.com@EXAMPLE.COM and the machine password set on the Apache KDC matches the machine password set on the Windows server.
$ smbclient //www.example.com/myshare -U hnelson -W EXAMPLE.COM -R host -k -d 3 lp_load: refreshing parameters Initialising global parameters params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf" Processing section "[global]" added interface ip=192.168.0.2 bcast=192.168.0.255 nmask=255.255.255.0 Client started (version 3.0.10-1.fc2). Connecting to 192.168.0.100 at port 445 Doing spnego session setup (blob length=120) got OID=1 2 840 48018 1 2 2 got OID=1 2 840 113554 1 2 2 got OID=1 2 840 113554 1 2 2 3 got OID=1 3 6 1 4 1 311 2 2 10 got principal=host/www.example.com@EXAMPLE.COM Doing kerberos session setup Ticket in ccache[FILE:/tmp/krb5cc_0] expiration Mon, 31 Oct 2005 20:11:23 GMT OS=[Windows Server 2003 3790] Server=[Windows Server 2003 5.2] smb: \> ls received 3 entries (eos=1) . D 0 Sun Oct 30 20:56:51 2005 .. D 0 Sun Oct 30 20:56:51 2005 readme.txt A 0 Sun Oct 30 20:56:51 2005 47692 blocks of size 2097152. 46664 blocks available Total bytes listed: 0 smb: \>
[root@www ~]# smbclient //www.example.com/myshare -U EXAMPLE.COM\\hnelson -D hnelson -k
OS=[Windows Server 2003 R2 3790 Service Pack 1] Server=[Windows Server 2003 R2 5.2]
smb: \hnelson\> dir
. D 0 Tue Jan 30 00:48:07 2007
.. D 0 Tue Jan 30 00:48:07 2007
readme.txt A 0 Tue Jan 30 00:48:07 2007
47692 blocks of size 2097152. 46664 blocks available
Total bytes listed: 0
smb: \hnelson\>