home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Unix Power ToolsUnix Power ToolsSearch this book

47.6. Connecting to SMB Shares from Unix

From Unix, you can connect to SMB shares with the smbclient command. It provides an ftp-like interactive environment for transferring files between your Unix system and the SMB share. It also is an excellent tool for debugging your Samba setup. For instance, you can see what shares are available from an SMB host with the following:

$ smbclient -L //netbios-name -U SMB_username

The -L flag request the list of available shares from the machine specified by its NETBIOS name. You may optionally provide an SMB username name with the -U flag. If no explicit username is provided, your Unix account name is used.

Once you have found a directory share that interests you, you can "log in" to it:

$ smbclient //netbios-name/share -U SMB_username
smb: />

You will be prompted for the SMB password associated with whichever account you used. If successful, you will be at an interactive prompt. You may type ? or help to get all the options available to you. Use the get command to copy files from the remote host to your Unix machine and put to copy files in the other direction. Like ftp, Samba also provides the filename wildcard variants mget and mput to allow you to handle multiple files easily.

-- JJ



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.