1 '\" te
   2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Right Reserved.
   3 .\" Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
   4 .\" Portions Copyright 1994-2008 The FreeBSD Project. All rights reserved.
   5 .\" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
   6 .\" disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND
   7 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   8 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   9 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10 .TH SMBUTIL 1 "Apr 11, 2018"
  11 .SH NAME
  12 smbutil \- Solaris CIFS client utility
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 \fB/usr/bin/smbutil crypt\fR
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fB/usr/bin/smbutil discon //[\fIdomain\fR;][\fIuser\fR@]\fIserver\fR\fR
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fB/usr/bin/smbutil login [-c] [[\fIdomain\fR/]\fIuser\fR]\fR
  27 .fi
  28 
  29 .LP
  30 .nf
  31 \fB/usr/bin/smbutil login [-c] [\fIuser\fR[@\fIdomain\fR]]\fR
  32 .fi
  33 
  34 .LP
  35 .nf
  36 \fB/usr/bin/smbutil logout [[\fIdomain\fR/]\fIuser\fR]\fR
  37 .fi
  38 
  39 .LP
  40 .nf
  41 \fB/usr/bin/smbutil logout [\fIuser\fR[@\fIdomain\fR]]\fR
  42 .fi
  43 
  44 .LP
  45 .nf
  46 \fB/usr/bin/smbutil logout -a\fR
  47 .fi
  48 
  49 .LP
  50 .nf
  51 \fB/usr/bin/smbutil logoutall\fR
  52 .fi
  53 
  54 .LP
  55 .nf
  56 \fB/usr/bin/smbutil lookup \fIname\fR\fR
  57 .fi
  58 
  59 .LP
  60 .nf
  61 \fB/usr/bin/smbutil status \fIserver\fR\fR
  62 .fi
  63 
  64 .LP
  65 .nf
  66 \fB/usr/bin/smbutil view [-A | -U \fIuser\fR] //[\fIdomain\fR;][\fIuser\fR[:\fIpassword\fR]@]\fIserver\fR\fR
  67 .fi
  68 
  69 .LP
  70 .nf
  71 \fB/usr/bin/smbutil [\fB-?dv\fR]\fR
  72 .fi
  73 
  74 .SH DESCRIPTION
  75 .sp
  76 .LP
  77 The \fBsmbutil\fR command controls the Solaris CIFS client and issues various
  78 commands.
  79 .SS "Subcommands"
  80 .sp
  81 .LP
  82 The \fBsmbutil\fR command supports the following subcommands:
  83 .sp
  84 .ne 2
  85 .na
  86 \fB\fBcrypt\fR\fR
  87 .ad
  88 .sp .6
  89 .RS 4n
  90 Creates a hash of a password. This subcommand prompts for a password and writes
  91 the hash to standard output. This hash value is suitable for use as a value for
  92 the \fBpassword\fR property in the \fB$HOME/.nsmbrc\fR file.
  93 .sp
  94 The hashed password begins with two dollar signs (\fB$$\fR). If you assign this
  95 hashed password to the \fBpassword\fR property in your \fB$HOME/.nsmbrc\fR, be
  96 sure that you escape the special characters in the password.
  97 .sp
  98 If you plan to store hashed passwords in your \fB$HOME/.nsmbrc\fR file, ensure
  99 that the file permissions are set so that only the owner can read or write the
 100 file (\fB400\fR or \fB600\fR), or the passwords are ignored.
 101 .RE
 102 
 103 .sp
 104 .ne 2
 105 .na
 106 \fB\fBdiscon -U \fIuser\fR]
 107 //[\fIdomain\fR;][\fIuser\fR\fIserver\fR\fR\fR
 108 .ad
 109 .sp .6
 110 .RS 4n
 111 Disconnects the specified SMB session to \fIserver\fR.
 112 Usage is similar to the \fB\fBview\fR\fR sub-command.
 113 This sub-command is primarily for use in tests.
 114 .RE
 115 
 116 .sp
 117 .ne 2
 118 .na
 119 \fB\fBlogin [-c] [ [[\fIdomain\fR/]\fIuser\fR] | [\fIuser\fR[@\fIdomain\fR]
 120 ]\fR\fR
 121 .ad
 122 .sp .6
 123 .RS 4n
 124 Specifies persistent password information to be used for a CIFS server user
 125 account. When you specify this information, mounts can be done without a
 126 password prompt in non-Kerberos configurations. Kerberos sites should use
 127 Kerberos automatically, not prompt for a password. If a default domain is
 128 available in SMF or \fBnsmbrc\fR(4), the domain can be omitted. If a user name
 129 is not specified, the Solaris user account name is used.
 130 .sp
 131 Use the \fB-c\fR to check whether a persistent password is set for the
 132 specified user.
 133 .sp
 134 Passwords can also be stored for a specific server by using a server name in
 135 place of the domain name. This capability is useful with servers that are
 136 configured for "workgroup mode."
 137 .RE
 138 
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fBlogout [ [[\fIdomain\fR/]\fIuser\fR] | [\fIuser\fR[@\fIdomain\fR] ]\fR\fR
 143 .ad
 144 .sp .6
 145 .RS 4n
 146 Erases the persistent passwords for the user running the command.
 147 .sp
 148 The user name and domain name portions of the name are optional. If these names
 149 are not specified, the user name and domain name values are taken from the
 150 properties set in your environment. See the \fBnsmbrc\fR(4) manual page.
 151 .sp
 152 If you stored your password for a specific server, specify the server name in
 153 place of the domain name.
 154 .RE
 155 
 156 .sp
 157 .ne 2
 158 .na
 159 \fB\fBlogout -a\fR\fR
 160 .ad
 161 .sp .6
 162 .RS 4n
 163 Erases all of the persistent passwords that are stored for the user who is
 164 running the command.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB\fBlogoutall\fR\fR
 171 .ad
 172 .sp .6
 173 .RS 4n
 174 Erases all the persistent passwords that are stored by all users running the
 175 \fBsmbutil login\fR command.
 176 .sp
 177 This command must be run as superuser.
 178 .RE
 179 
 180 .sp
 181 .ne 2
 182 .na
 183 \fB\fBlookup \fIname\fR\fR\fR
 184 .ad
 185 .sp .6
 186 .RS 4n
 187 Resolves the specified \fIname\fR to an IP address.
 188 .sp
 189 This subcommand is only supported if an NBNS/WINS name server is available.
 190 .RE
 191 
 192 .sp
 193 .ne 2
 194 .na
 195 \fB\fBstatus \fIserver\fR\fR\fR
 196 .ad
 197 .sp .6
 198 .RS 4n
 199 Resolves the specified server to the NetBIOS domain and system name.
 200 \fIserver\fR can be an IP address or a DNS name.
 201 .RE
 202 
 203 .sp
 204 .ne 2
 205 .na
 206 \fB\fBview [-A | -U \fIuser\fR]
 207 //[\fIdomain\fR;][\fIuser\fR[:\fIpassword\fR]@]\fIserver\fR\fR\fR
 208 .ad
 209 .sp .6
 210 .RS 4n
 211 Lists the resources available to \fIuser\fR on the specified \fIserver\fR.
 212 .sp
 213 You can specify the \fB-A\fR option to view the resources as an anonymous user
 214 or the \fB-U\fR \fIuser\fR option to view the resources as the specified user.
 215 These options are mutually exclusive.
 216 .sp
 217 If the resource includes a domain, you must escape the semicolon that appears
 218 after the domain name to prevent it from being interpreted by the command
 219 shell. For instance, surround the entire resource name with single quotes:
 220 \fBsmbutil view '//SALES;george@RSERVER'\fR.
 221 .RE
 222 
 223 .SH OPTIONS
 224 .sp
 225 .LP
 226 The following global options are supported:
 227 .sp
 228 .ne 2
 229 .na
 230 \fB\fB-d\fR\fR
 231 .ad
 232 .RS 13n
 233 Produces debugging output.
 234 .RE
 235 
 236 .sp
 237 .ne 2
 238 .na
 239 \fB\fB-v\fR\fR
 240 .ad
 241 .RS 13n
 242 Produces verbose output.
 243 .RE
 244 
 245 .sp
 246 .ne 2
 247 .na
 248 \fB\fB-?\fR\fR
 249 .ad
 250 .RS 13n
 251 Prints a short help message.
 252 .RE
 253 
 254 .SH EXAMPLES
 255 .LP
 256 \fBExample 1 \fRCreating a Password Hash for the \fB$HOME/.nsmbrc\fR File
 257 .sp
 258 .LP
 259 The following example shows how to use the \fBsmbutil crypt\fR command to
 260 create a hash of the password you specify. Then, you can use the hash as the
 261 value for the \fB$HOME/.nsmbrc\fR file.
 262 
 263 .sp
 264 .LP
 265 Be sure to escape the two dollar-sign prefix of the hashed password if you
 266 store it as a value of the \fBpassword\fR property.
 267 
 268 .sp
 269 .in +2
 270 .nf
 271 $ \fBsmbutil crypt\fR
 272 Password:
 273 $$178465324253e0c07
 274 .fi
 275 .in -2
 276 .sp
 277 
 278 .sp
 279 .LP
 280 The following \fB$HOME/.nsmbrc\fR file fragment shows how the password hash
 281 value is set:
 282 
 283 .sp
 284 .in +2
 285 .nf
 286 [RSERVER:george]
 287 charsets=koi8-r:cp866
 288 password='$$178465324253e0c07'
 289 .fi
 290 .in -2
 291 .sp
 292 
 293 .LP
 294 \fBExample 2 \fRStoring a Password for a CIFS Server
 295 .sp
 296 .LP
 297 The following example shows how to use the \fBsmbutil login\fR command to store
 298 the \fBroot@example\fR user's password.
 299 
 300 .sp
 301 .in +2
 302 .nf
 303 $ \fBsmbutil login root@example\fR
 304 Password:
 305 .fi
 306 .in -2
 307 .sp
 308 
 309 .LP
 310 \fBExample 3 \fRErasing the Stored Password
 311 .sp
 312 .LP
 313 The following example shows how to use the \fBsmbutil logout\fR command to
 314 remove the \fBroot@example\fR user's password.
 315 
 316 .sp
 317 .in +2
 318 .nf
 319 $ \fBsmbutil logout root@example\fR
 320 .fi
 321 .in -2
 322 .sp
 323 
 324 .LP
 325 \fBExample 4 \fRViewing Available Shares
 326 .sp
 327 .LP
 328 The following example shows how to use the \fBsmbutil view\fR command to see
 329 the available shares for user \fBroot\fR on server \fBexample\fR.
 330 
 331 .sp
 332 .in +2
 333 .nf
 334 $ \fBsmbutil view //root@example\fR
 335 Password:
 336 Share        Type       Comment
 337 -------------------------------
 338 netlogon     disk       Network Logon Service
 339 ipc$         IPC        IPC Service (Samba Server)
 340 tmp          disk       Temporary file space
 341 public       disk       Public Stuff
 342 root         disk       Home Directories
 343 
 344 5 shares listed from 5 available
 345 .fi
 346 .in -2
 347 .sp
 348 
 349 .LP
 350 \fBExample 5 \fRViewing Available Shares as an Anonymous User
 351 .sp
 352 .LP
 353 The following example shows how to use the \fBsmbutil view\fR command to
 354 anonymously view the available shares on the \fBexample\fR server.
 355 
 356 .sp
 357 .in +2
 358 .nf
 359 $ \fBsmbutil view -A //example\fR
 360 Share        Type       Comment
 361 -------------------------------
 362 netlogon     disk       Network Logon Service
 363 ipc$         IPC        IPC Service (Samba Server)
 364 tmp          disk       Temporary file space
 365 public       disk       Public Stuff
 366 ethereal     disk       /export/ethereal
 367 myshare      disk       Jan's stuff
 368 
 369 6 shares listed from 6 available
 370 .fi
 371 .in -2
 372 .sp
 373 
 374 .LP
 375 \fBExample 6 \fRObtaining the IP Address From a Server Name
 376 .sp
 377 .LP
 378 The following example shows how to use the \fBsmbutil lookup\fR command to
 379 obtain the IP address of the \fBexample\fR server.
 380 
 381 .sp
 382 .in +2
 383 .nf
 384 $ \fBsmbutil lookup example\fR
 385 Got response from 192.168.168.210
 386 IP address of example: 192.168.168.210
 387 .fi
 388 .in -2
 389 .sp
 390 
 391 .LP
 392 \fBExample 7 \fRObtaining the NetBIOS Domain and System Name Using the Server
 393 Name
 394 .sp
 395 .LP
 396 The following example shows how to use the \fBsmbutil status\fR command to
 397 obtain the NetBIOS domain and system name of the \fBexample\fR server. The
 398 server name, \fBexample\fR, is specified on the command line.
 399 
 400 .sp
 401 .in +2
 402 .nf
 403 $ \fBsmbutil status example\fR
 404 Domain: WORKGROUP
 405 Server: EXAMPLE
 406 .fi
 407 .in -2
 408 .sp
 409 
 410 .LP
 411 \fBExample 8 \fRObtaining the NetBIOS Domain and System Name Using the IP
 412 Address
 413 .sp
 414 .LP
 415 The following example shows how to use the \fBsmbutil status\fR command to
 416 obtain the NetBIOS domain and system name of the \fBexample\fR server. The IP
 417 address, \fB192.168.168.210\fR, is specified on the command line.
 418 
 419 .sp
 420 .in +2
 421 .nf
 422 $ \fBsmbutil status 192.168.168.210\fR
 423 Domain: WORKGROUP
 424 Server: EXAMPLE
 425 .fi
 426 .in -2
 427 .sp
 428 
 429 .SH FILES
 430 .sp
 431 .ne 2
 432 .na
 433 \fB\fB$HOME/.nsmbrc\fR\fR
 434 .ad
 435 .sp .6
 436 .RS 4n
 437 User-settable mount point configuration file to store the description for each
 438 connection.
 439 .RE
 440 
 441 .SH ATTRIBUTES
 442 .sp
 443 .LP
 444 See \fBattributes\fR(5) for descriptions of the following attributes:
 445 .sp
 446 
 447 .sp
 448 .TS
 449 box;
 450 c | c
 451 l | l .
 452 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 453 _
 454 Interface Stability     See below.
 455 .TE
 456 
 457 .sp
 458 .LP
 459 The output is Uncommitted. The rest of the interface is Committed.
 460 .SH SEE ALSO
 461 .sp
 462 .LP
 463 \fBmount_smbfs\fR(1M), \fBnsmbrc\fR(4), \fBattributes\fR(5), \fBsmbfs\fR(7FS)
 464 .SH AUTHORS
 465 .sp
 466 .LP
 467 This manual page contains material originally authored by Boris Popov,
 468 \fBbp@butya.kz\fR, \fBbp@FreeBSD.org\fR.
 469 .SH NOTES
 470 .sp
 471 .LP
 472 The Solaris CIFS client always attempts to use \fBgethostbyname()\fR to resolve
 473 host names. If the host name cannot be resolved, the CIFS client uses NetBIOS
 474 name resolution (NBNS). By default, the Solaris CIFS client permits the use of
 475 NBNS to enable Solaris CIFS clients in Windows environments to work without
 476 additional configuration.
 477 .sp
 478 .LP
 479 Since NBNS has been exploited in the past, you might want to disable it. To
 480 disable NBNS, set the \fBnbns-enabled\fR service management facility property
 481 to \fBfalse\fR. By default, \fBnbns-enabled\fR is set to \fBtrue\fR.