Home arrow Site Administration arrow Page 2 - Advanced Concepts on Dealing with Files and Filesystems in BSD

HACK#19: Access Windows Shares Without a Server - Administration

In this conclusion to a two-part article, we continue our discussion of BSD commands and filesystems. It is excerpted from chapter two of the book BSD Hacks, written by Dru Lavigne (O'Reilly, 2005; ISBN: 0596006799). Copyright 2005 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

TABLE OF CONTENTS:
  1. Advanced Concepts on Dealing with Files and Filesystems in BSD
  2. HACK#19: Access Windows Shares Without a Server
  3. HACK#20: Deal with Disk Hogs
  4. HACK#21: Manage Temporary Files and Swap Space
  5. HACK#22: Recreate a Directory Structure Using mtree
  6. HACK#23: Ghosting Systems
By: O'Reilly Media
Rating: starstarstarstarstar / 8
January 04, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Share files between Windows and FreeBSD with a minimum of fuss.

You've probably heard of some of the Unix utilities available for accessing files residing on Microsoft systems. For example, FreeBSD provides themount_smbfsandsmbutil utilities to mount Windows shares and view or access resources on a Microsoft network. However, both of those utilities have a caveat: they require an SMB server. The assumption is that somewhere in your network there is at least one NT or 2000 Server.

Not all networks have the budget or the administrative expertise to allow for commercial server operating systems. Sure, you can install and configure Samba, but isn't that overkill for, say, a home or very small office network? Sometimes you just want to share some files between a Windows 9x system and a Unix system. It's a matter of using the right-sized tool for the job. You don't bring in a backhoe to plant flowers in a window box.

Installing and Configuring Sharity-Light

If your small network contains a mix of Microsoft and Unix clients, consider installing Sharity-Light on the Unix systems. This application allows you to mount a Windows share from a Unix system. FreeBSD provides a port for this purpose (see the Sharity-Light web site for other supported platforms):

  # cd /usr/ports/net/sharity-light
  # 
make install clean

Since Sharity-Light is a command-line utility, you should be familiar with UNC or the Universal Naming Convention. UNC is how you refer to Microsoft shared resources from the command line. A UNC looks like \\NetBIOSname\sharename . It starts with double backslashes, then contains the NetBIOS name of the computer to access and the name of the share on that computer.

Since Sharity-Light is a command-line utility, you should be familiar with UNC or the Universal Naming Convention. UNC is how you refer to Microsoft shared resources from the command line. A UNC looks like

Before using Sharity-Light, you need to know the NetBIOS names of the computers you wish to access. If you have multiple machines running Microsoft operating systems, the quickest way to view each systems name is withnbtstat. From one of the Windows systems, open a command prompt and type:

  C:> nbtstat -A 192.168.2.10
        
NETBIOS Remote Machine Name Table
   
Name         Type        Status 
  -----------------------------------------  LITTLE_WOLF  <00> UNIQUE    Registered
  <snip>

Repeat for each IP address in your network. Your output will be several lines long, but the entry (usually the first) containing<00>is the one with the name you're interested in. In this example,LITTLE_WOLFis the NetBIOS name associated with 192.168.2.10.

Even thoughnbtstat ?indicates that-Ais used to view a remote system, it also works with the IP address of the local system. This allows you to check all of the IP addresses in your network from the same system.

Once you know which IP addresses are associated with which NetBIOS names, you'll need to add that information to /etc/hosts on your Unix systems:

  # more /etc/hosts
  127.0.0.1        localhost
  192.168.2.95     genisis       #this system 
  192.168.2.10     little_wolf   #98 system sharing cygwin2

You'll also need to know the names of the shares you wish to access. Again, from a Microsoft command prompt, repeat this command for each Net-BIOS name and make note of your results:

  C:> net view \\little_wolf
  Shared resources at \\LITTLE_WOLF
  Sharename     Type      Comment

  -------------------------------------
  CYGWIN2      Disk
  The command was completed successfully.

Here the computer known asLITTLE_WOLFhas only one share, the CYGWIN2 directory.

Finally, you'll need a mount point on your Unix system, so you might as well give it a useful name. Since the typical floppy mount point is /floppy and the typical CD mount point is /cdrom, let's use /windows:

  # mkdir /windows

Accessing Microsoft Shares

Once you know the names of your computers and shares, using Sharity-Light is very easy. As the superuser, mount the desired share:

  # shlight    //little_wolf/cygwin2 /windows   
  Password:
  Using port 49923 for NFS.

Watch your slashes. Microsoft uses the backslash (\)  at the command line, whereas Unix and Sharity-Light use the forward slash (/).

Note that I was prompted for a password because Windows 9x and ME users have the option of password protecting their shares. This particular share did not have a password, so I simply pressed Enter.

Adding-nto the previous command will forego the password prompt. Typeshlight -hto see all available options.

However, if the share is on a Windows NT Workstation, 2000 Pro, or XP system, you must provide a username and password valid on that system. The syntax is:

  # shlight //2000pro/cdrom /windows -U username -P password

Once the share is mounted, it works like any other mount point. Depending on the permissions set on the share, you should be able to browse that shared directory, copy over or add files, and modify files. When you're finished using the share, unmount it:

   $ unshlight /windows

See Also

  • The Sharity-Light README and FAQ (/usr/local/share/doc/Sharity-Light/)
  • The Sharity-Light web site
    (http://www.obdev.at/products/sharity-light/index.html)
  • The Samba web site (http://www.samba.org/)



 
 
>>> More Site Administration Articles          >>> More By O'Reilly Media
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: