5.5 smbsh

   

5.5 smbsh

The smbsh program is part of the Samba suite and works on some, but not all, Unix variants. [3] Effectively, it adds a wrapper around the user's command shell, enabling it and common Unix utilities to work on files and directories in SMB shares, in addition to files and directories in the local Unix filesystem. From the user 's perspective, the effect is that of a simulated mount of the SMB shares onto the Unix filesystem.

[3] At the time of this writing, smbsh does not work on HP/UX or Linux. However, Linux support might return in the future.

smbsh works by running the shell and programs run from it in an environment in which calls to the standard C library are redirected to the smbwrapper library, which has support for operating on SMB shares. This redirection can work only if the program being run is dynamically linked. Fortunately, modern Unix versions ship with most common utilities linked dynamically rather than statically.

To determine whether a program is dynamically or statically linked, try using the file command.

To use smbsh , your Samba installation must be configured using the configure option --with-smbwrapper .

If you have a number of Unix systems with the same host operating system and architecture and don't want to bother with a full Samba installation, you can simply move the following files to the other systems:

 /usr/local/samba/bin/smbsh /usr/local/samba/bin/smbwrapper.so /usr/local/samba/lib/smb.conf 

Make sure that /usr/local/samba/bin is in your shell's search path . The smb.conf file is needed only for smbsh to determine the workgroup or domain and does not need to be as elaborate as your Samba server's configuration file.

5.5.1 An Interactive Session with smbsh

To start smbsh , simply type in the smbsh command at the shell prompt. You will be prompted for a username and password with which to authenticate on the SMB network:

 $  smbsh  Username: davecb Password: smbsh$ 

While working within the smbsh shell, you have a virtual /smb directory. This does not actually exist in the Unix filesystem and is supported within smbsh only to help organize the SMB shares in a structure familiar to Unix users. You can list the contents of the /smb virtual directory and get a list of workgroups in the local network, which are also presented as virtual directories:

 smbsh$  cd /smb ; ls  ZOOL PLANK BACIL 

You can change your working directory to one of the workgroup virtual directories, and listing one of them will show the computers in the workgroup:

 smbsh$  cd ZOOL ; ls  ANTILLES         DODO             MILO             SEAL ARGON            HANGGLIDE        OSTRICH          SPARTA BALLET           INFUSION         PLAQUE           THEBES CHABLIS          JAZ              PRAETORIAN       TJ COBRA            KIKO             RAYOPCI          TRANCE COUGUR           MACHINE-HEADPCI  RUMYA            VIPERPCI CRUSTY           MATHUMA          SCOT 

Likewise, you can change your current directory to, and list the contents of, a computer virtual directory, and then you can see a listing of shares offered by that computer:

 smbsh$  cd scot ; ls  ADMIN$      davecb      nc          np2s        pl ace         dhcp-mrk03  np          nps         xp cl          ep          np2         opcom 

This is the lowest level of smbsh 's virtual directory system. Once you cd into a share, you are within the SMB share on the remote computer:

 smbsh$  cd davecb ; ls  Mail                                mkanalysis_dirs.idx SUNWexplo                           nfs.ps Sent                                nsmail allsun.html                         projects.txt bin                                 sumtimex 

Once in a remote share, most of the Unix shell utilities will work, and you can operate on files and directories much as you would on any Unix system. You can even create symbolic links in the Unix filesystem pointing to files and directories in the SMB share. However, attempts to create symbolic links in the SMB share will fail unless the share is being served by Samba with support for Unix CIFS extensions.

   


Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2003
Pages: 475

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net