Administration
  Home arrow Administration arrow Page 2 - Advanced Concepts on Dealing with File...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADMINISTRATION

Advanced Concepts on Dealing with Files and Filesystems in BSD
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2007-01-04

    Table of Contents:
  • Advanced Concepts on Dealing with Files and Filesystems in BSD
  • HACK#19: Access Windows Shares Without a Server
  • HACK#20: Deal with Disk Hogs
  • HACK#21: Manage Temporary Files and Swap Space
  • HACK#22: Recreate a Directory Structure Using mtree
  • HACK#23: Ghosting Systems

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Create a Highly Available Database Solution. Advantage Database Server can provide the availability to keep your data safe and ready for your application and users.

    Advanced Concepts on Dealing with Files and Filesystems in BSD - HACK#19: Access Windows Shares Without a Server
    (Page 2 of 6 )

    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 Administration Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "BSD Hacks," published by O'Reilly. We hope...
     

    Buy this book now. This article is excerpted from chapter two of the book BSD Hacks, written by Dru Lavigne (O'Reilly, 2005; ISBN: 0596006799). Check it out today at your favorite bookstore. Buy this book now.

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway