Administration
  Home arrow Administration arrow Page 2 - Advanced Concepts on Dealing with Files and Filesystems in BSD
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
ADMINISTRATION

Advanced Concepts on Dealing with Files and Filesystems in BSD
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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 the mount_smbfs and smbutil 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 with nbtstat . 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    Registere d
      <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_WOLF is the NetBIOS name associated with 192.168.2.10.

    Even though nbtstat ? indicates that -A is used to view a remot e 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 as LITTLE_WOLF has 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 /flopp y 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 -n to the previous command will forego the password prompt. Type shlight -h to 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
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek