Access Windows Shares Under Mac OS X in 10 Easy Steps

n8

Registered
I wrote the following HOW-TO on accessing Windows shares under OS X, hope it helps some of you guys out!

Feedback is welcome...let me know how it works out...

-Nathan Odle
nathano@odle-associates.com

-------------


HOW-TO: Sharity on Mac OS X
Maintainer: Nathan Odle, nathano@odle-associates.com


For all of you that think that Samba will solve your SMB-mounting troubles, you'll be disappointed to hear that it won't. Don't confuse sharing with mounting though - if you want to create SMB (Windows)-compatible shares, it's Samba you want. However, if you want to mount other systems' shares into the OS X filesystem, you need a little application called Sharity, by Objective Development (http://www.obdev.at/Products/Sharity.html). The reason Samba won't work for this is that the distribution is lacking a little program called SMBFS (a.k.a. "smbmount") that comes ONLY on the Linux distribution. SMBFS development is completely seperate from the Samba effort, and was developed for Linux. Someone is working on a *BSD port, but compilation fails under OS X Public Beta.

So, we're left with Sharity. Sharity mimics the behaviour of SMBFS, giving you a "daemon" (Mac users - think "extension") and command-line utilities to mount, unmount, browse, etc. Most importantly, the most recent (2.4Beta4) release supports Mac OS X Server, and appears to work under the OS X Public Beta as well. Although Sharity is a commercial product, free licenses are available for those associated with academic institutions. At the end of this document, there will be a description of how to obtain licensing and how to set it up once you have your key. This is important, because without a valid license key, you are limited to how deep you can go in the file system hierarchy. It's also good karma :)

In order to get Sharity running, the first thing you'll want to do is visit the Sharity website and download the most current binary release for OS X to your desktop (important - these directions assume that you're downloading to the desktop - anything else, and YMMV...Your Mileage May Vary). As of this writing, it was available at the following link:

http://www.obdev.at/ftp/pub/Products/Sharity/binaries/Sharity.2.4Beta4.MacOSX-DP3.tgz

While you're at it, grab the Sharity "StartupParameters.plist" file I've created (for use in getting Sharity to run at startup) at:

http://www.cf.missouri.edu/howto/StartupParameters.plist

IF USING INTERNET EXPLORER, MAKE SURE TO HOLD THE CONTROL KEY AS YOU CLICK THE LINK, SELECT "Download Link to Disk", AND SELECT YOUR DESKTOP AS THE DESTINATION WHEN THE OPEN DIALOG POPS UP.

Next, you'll need to start Terminal and install/configure Sharity. Remember: All examples here will assume that you downloaded it to your desktop! If you did otherwise, you'll have to be clever and change the paths. Here's the step-by-step, things you have to type are in bold:

1) Start the Terminal program. From a Finder window browse to Applications, then to the Utilities folder contained within. Double-click on the icon marked Terminal.


2) The Terminal shell will start in your home directory. Issue the following command (note the difference between "/" and "\", and make sure you realize all of this IS CASE SENSITIVE):

cd Library/Desktop


3) Now, we need to "untar" (uncompress) the file:

tar -zxvf Sharity.2.4Beta4.MacOSX-DP3.tar.gz


4) This created a directory on our desktop called "Sharity.2.4Beta4.MacOSX-DP3-G3". We will change to this directory:

cd Sharity.2.4Beta4.MacOSX-DP3-G3


5) Next, we need to become the user "root" so that we have sufficient privleges to install Sharity. When prompted for the password, use the same password as the administrator user you setup when you installed OS X:

su


6) Now, we run the setup script. (make sure you use the "." in "./setup"):

./setup


7) Answer the questions according to the defaults (to use the default, just press "return") except for two items. The first item is the WINS server configuration. If you have a WINS server you should give that information to Sharity. The second item is where it asks for your workgroup name. There, you should enter your network's workgroup name. Once you've answered all the questions, Sharity will configure itself, and copy the files to the correct locations.


8) Now, we need to make sure the Sharity daemon (sharityd) runs at startup. In order to do this, we need to create a new directory bundle in the StartupItems folder that tells OS X how to load Sharity:

First, we move up one directory to get us back on the desktop.
cd ..

Next, we make a new directory in StartupItems for Sharity.
mkdir /System/Library/StartupItems/Sharity

Now we move the StartupParameters.plist file that we downloaded earlier from the desktop to our new directory.
mv StartupParameters.plist /System/Library/StartupItems/Sharity

Finally, we make a symbolic link to sharity.init in our new directory.
ln -s /usr/local/sharity/sbin/sharity.init /System/Library/StartupItems/Sharity


9) Now that we've got the Sharity daemon ready to go at startup, we need to restart the machine and make sure it's working. So, go ahead and restart.


10) To test that Sharity is up and running, we can use the ProcessViewer application that's in the same place we found Terminal. If you start ProcessViewer you'll see in the process list an item called "sharityd" if all went well. Another way we can do this is to leverage a couple command-line utilities called ps (shows the process list) and grep (finds a pattern in it's input and outputs the line containing the pattern). We "pipe" the output from ps to the input of grep using the "|" character (that's SHIFT - \). So, start Terminal as in Step 1 and type the following at the command line:

ps ax | grep sharityd

If all went well, you'll see something similar to the following, otherwise you won't see anything at all:

207 S s 0:05.87 sharityd

You can try using just the ps ax command by itself if you want to see a list of all the processes running on the system. You'll notice that grep pulled out the line with "sharityd" in it for us.

If everything looks good, CONGRATULATIONS! You're ready to use Sharity to mount and manage SMB (a.k.a. CIFS - "Common Internet FileSystem") shares. In addition, the OS X distribution comes with a GUI. As of the time of this writing it would not run under the Public Beta, but I've been in contact with Christian Starkjohann of Objective Development and he sent me a recompiled version that seems to be working fine. Details on how to obtain the updated GUI (Sharity.app) will be forthcoming :)

One nice thing that Sharity did for us when it started up was create a special directory that will act like the "Network Neighborhood" under Windows; that is, when you open it you'll see a listing of machines, open a machine, you see a list of shares, etc. To get there, we can open the Finder and browse to "Computer", and from there browse to "Network". Inside, you'll see an alias to "CIFS". Open it up, and Voila! There's your workgroup!

NOTE: If you open a server and do not see its shares, then you need to login to it with the appropriate username and password. Go to the Terminal once again, and issue the following command, replacing servername, username, and password with the proper information:

cifslogin servername -U username -P password


SPECIAL NOTE: Licensing Sharity

Sharity is crippled unless you register it with Objective Development. To obtain full-functionality, you need to get a license key and apply it to Sharity. Again, here's the step-by-step:

1) Go to the Sharity price and ordering page at: http://www.obdev.at/Products/SharityPrice.html. Here, you can order a license if it's for commercial use, or apply for a free Sharity Academic license. Follow the directions to obtain your license key. If it's an academic license, you will have to wait a couple days for them to verify your academic status and email your license key.

2) Once you have the license key, you'll need to apply it to Sharity. Start Terminal as you did before to install Sharity. Then enter the following command, replacing key with the license key you obtained (you may have to become the user "root" as you did before to install Sharity):

/usr/local/sharity/bin/cifslicense key

There you go!


References:

Objective Development - Creators of Sharity
http://www.obdev.at/Products/Sharity.html

Wilfredo Sanchez - worked on creating the new startup scheme for OS X. A mailing list message describing his work can be found here: http://lists.openresources.com/NetBSD/tech-userlevel/msg01303.html

[Edited by n8 on 09-29-2000 at 04:30 PM]
 
Been in contact with Objective Development and they are going to post the HOW-TO on their website...

-n8
 
Has anyone gottne this to work? I have gotten as far as seeing sharityd in the ProcessViewer, but I can't seem to get the CIFS folder open. Any ideas on how to get this to work with the Public Beta.

Thanks,

Andy
 
I can get to the Workgroup by going through the terminal by typing in

cd /Network/CIFS

but I can't get to the same place by clicking on the CIFS folder in the Network folder... it keeps telling me that my alias needs to be updated... also, I have to manually start up Sharity when I restart the computer -- you need to go into the Terminal... go into the mode where you have to put in your password -- you have to input:

su

and then you can navigate to the Sharity folder and the packages folder (/Users/yourusername/Library/Desktop/Sharity.2.4Beta4.MacOSX-DP3-G3/packages) and type:

./sharity.init

and that will start it up manually... however... I can't get to the CIFS folder in the Finder... I have to use the Terminal...


-Andy
 
Hi, I did this and encountered a couple of problems:

1 - the file is not "Sharity.2.4Beta4.MacOSX-DP3-G3.tar.gz "

it is "Sharity.2.4Beta4.MacOSX-DP3.tgz "

Aside from that things went well until after the restart:
2 - the demon isn't starting.

I tried starting it manually and I get the following error:

Starting Sharity daemon:
./sharity.init: permission denied: /usr/local/sharity/sbin/sharityd [75]
cat: /usr/local/sharity/var/sharity.pid: No such file or directory
renice: 0: setpriority: Permission denied

I tried "su"ing again and trying to start it manually as root, and it worked! I can see my workgroup, and after the cifslogin thing, I was able to view the files on my PeeCee. So the question is: How do I fix the permissions so it will startup automatically?

thx for posting this, btw, what a great thing to not have to explain ftp files back and forth between these computers!
 
As far as the permissions are concerned, I'm afraid that I can't be of too much help without seeing what perms you have on your files. Try using chown to change ownership of the alias and/or sharity.init. Also be sure that they are chmod +x. Could someone who can't get it to work do an 'ls' of their /System/Library/StartupItems/Sharity/ directory and also their /usr/local/Sharity/sbin and post it here?

For Andy: do a cifslist from the Terminal and see if there's a line like:

/Network/CIFS root cifsBrowse browser MSR

And get back to me...


As for the filename, thanks - I guess at 3am I was a little tired - it's fixed now ;) We'll see what happens with the permissions trouble (it worked for me)...

-n8

[Edited by n8 on 09-29-2000 at 04:40 PM]
 
When I first started working on this, I noticed that there was a (Yellow Box) GUI that came with the OS X Server Sharity distribution, but running it came up with an error. Well...I've been in contact with Christian Starkjohann at Objective Development and he's recompiled it under the PB and guess what - it works! You still need to go through the trouble of installing Sharity, etc. but once you have sharityd up and running you can use the GUI to manage shares. I've emailed Christian for permission to share his recompiled GUI, or perhaps he'll post it somewhere where we can all get at it...

-n8
 
/Library/StartupItems/Sharity
--------------------------------------
-rw-r--r-- 1 root wheel 215 Sep 28 08:19 StartupParameters.plist
lrwxr-xr-x 1 root wheel 36 Sep 29 12:39 sharity.init -> /usr/local/sharity/sbin/sharity.init

/usr/local/sharity/sbin
-----------------------------
-rwxr-xr-x 1 root wheel 2803 Sep 29 12:16 sharity.init
-rwx------ 1 root wheel 462380 Apr 29 11:04 sharityd

(I changed the sharityd from staff to wheel, thinking that would fix it, but it is still not working).
 
Ok, here are instructions that worked for me. I've taken most of what n8 but changed it slightly. First of all, unlike his instructions suggest, you should never place anything inside the /System/Library. It is for System software that comes from Apple. Instead install in /Library, which is for add-ons. I've taken that into account for the following instructions:

-------------

1. Download Sharity at:

http://www.obdev.at/ftp/pub/Products/Sharity/binaries/Sharity.2.4Beta4.MacOSX-DP3.tgz

Make sure you uncompress it properly. I recommend OpenUp 2.5. I found some other methods corrupted Sharity.app.

2. Download "Sharity.sit" at:

http://pantheon.yale.edu/~meh34/Sharity.sit

3. Start the Terminal program. From a Finder window browse to Applications, then to the Utilities folder contained within. Double-click on the icon marked Terminal.

4. The Terminal shell will start in your home directory. Issue the following command (note the difference between "/" and "\", and make sure you realize all of this IS CASE SENSITIVE):

<B>cd Library/Desktop</B>

5. Now, we need to "untar" (uncompress) the file:

<B>tar -zxvf Sharity.2.4Beta4.MacOSX-DP3.tgz</B>

6. This created a directory on our desktop called "Sharity.2.4Beta4.MacOSX-DP3-G3". We will change to this directory:

<B>cd Sharity.2.4Beta4.MacOSX-DP3-G3</B>

6. Next, we need to become the user "root" so that we have sufficient privleges to install Sharity. When prompted for the password, use the same password as the administrator user you setup when you installed OS X:

<B>su</B>

7. Now, we run the setup script. (make sure you use the "." in "./setup"):

<B>./setup</B>

8. Answer the questions according to the defaults (to use the default, just press "return") except for two items. The first item is the WINS server configuration. If you have a WINS server you should give that information to Sharity. The second item is where it asks for your workgroup name. There, you should enter your network's workgroup name. Once you've answered all the questions, Sharity will configure itself, and copy the files to the correct locations.

9. Now, we need to make sure the Sharity daemon (sharityd) runs at startup. In order to do this, we need to create a new directory bundle in the StartupItems folder that tells OS X how to load Sharity. Type the following commands:

<B>mkdir /Library/StartupItems/</B>

If it returns "mkdir: StartupItems: File exists" don't worry. Now you need to unstuff the file "Sharity.sit" which should be on your desktop. This puts a folder named "Sharity" on your desktop. Now return to the console and type (still as a su):

<B>mv /Users/nameofuser/Library/Desktop/Sharity/ /Library/StartupItems/</B>

where nameofuser is the name of the account you logged in as. This is to move the "Sharity" folder on your desktop into the /Library/StartupItems directory.

10. Now we just need to make sure the files have the proper ownership. Still in Terminal, type the following:

<B>chmod -R ugo+x /Library/StartupItems/</B>

(you may also need to run <B>chown -R root:admin /Library/StartupItems/</B>)


11. Now you need edit the hostconfig file, which tells Mac OS X what daemons to start up:

<B>pico /etc/hostconfig</B>

Now just add a line similar to the other services ("SHARITY=-YES-"), somewhere in the list. I put mine in alphabetically, in between NISDOMAIN and TIMESYNC so it looks like this:

NISDOMAIN=-NO-
<B>SHARITY=-YES-</B>
TIMESYNC=-YES-

-------------

Now all you need is to restart. Some additional notes:

A. If you want to disable Sharity, simply change the "YES" in hostconfig to a "NO".

B. You can uninstall Sharity by running:

<B>/usr/local/sharity/uninstall</B>

C. Use Processviewer to make sure "sharityd" is running after your restart.

D. In the decompressed package "Sharity.2.4Beta4.MacOSX-DP3-G3" on your desktop, there is a nice graphic front-end. Put it in your Applications folder. It's it little buggy, but it needs to be open when you access shares with passwords. Otherwise I found the desktop would crash. Your shares will be located in /Network/CIFS/ and can be accessed through the Finder (no command line!).


Have fun!

-Matthew Herberg

PS: There may be a few mistakes here, but I hope not. I'd appreciate feedback if that is the case.

[Edited by VanillaIcee on 09-29-2000 at 11:35 PM]
 
After all that, are you able to view the shared folders in the Finder? (By double-clicking on Network and then double-clicking on CIFS)

I can't see if any of this helps until Monday when I go back to work, but I want to know if any of you have gotten it so that you can get to the files on shared directories in the Finder as opposed to the Terminal/

Thank you,

Andy
 
You still can't access anything that Sharity mounts via Classic, because under classic you can't see anything in the "network" area of the OS X filesystem - it never even appears as an option from Classic dialogs.

The best solution to get this to work under Classic AND Mac OS X may be to use PC MacLAN on the PC server.

Unfortunately....


Anyone have a better idea?
 
Ok, I got Sharity installed and I can see my workgroup in the CIFS folder (although not in the GUI, but I can live with that). I can see the computers, but not the folders in them, and I never needed to login with a login/pass on a PC. There is one computer where I can see the folders inside, but when I click on one of them the Finder crashes. What's wrong?
 
Sharity is beta, so it crashes. It also crashes the Desktop when you don't have Sharity running and you try to access a share.

Simply keep the graphical user interface Sharity.app open when you access a share from the finder. The application is located in the installer folder (when you first uncompress the package) and it's name is "Sharity". It even has a nice blue and white icon.

That should solve the crashes and make it work.

-Matt

PS: Actually, even with Sharity open I've noticed a crash once in a while. Don't worry.. just reopen sharity and try again.
 
Installing was easy and I can see all the shares. My problem is that the .app will not load on my computer =/ it starts to load and then crashes, does this sound like a config problem or it just doesn't like me? Any advice or thoughts to the root of the problem?

B&W G3 450
320 MB
 
First of all thanks to N8 and VanillaIcee for posting the how-to's on Sharity...

Unfortunately I haven't quite got Sharity working but I'm close so maybe somone can help me out. I installed sharity as per VanillaIcee instructions, everything went fine as far as I could tell.

As of now I can browse through the Finder->Network/ and see both my Windows NT machine and Snap! server. However when I go into either folder representing the other machines I see no files what so ever... Same is true form the terminal window. The only obvious problem is that the Sharity GUI will now work, it begins to load and then the app quits. I noticed a post above mine and unstuffed the app with OpenUp, this way I was able to at least install as root, however the same thing happened with the app quitting.

In the Process viewer I see that Sharityd is running with user listed as "nobody" is this normal...?

any help would be appreciated, Tony

 
First of all thanks to N8 and VanillaIcee for posting the how-to's on Sharity...

Unfortunately I haven't quite got Sharity working but I'm close so maybe somone can help me out. I installed sharity as per VanillaIcee instructions, everything went fine as far as I could tell.

As of now I can browse through the Finder->Network/ and see both my Windows NT machine and Snap! server. However when I go into either folder representing the other machines I see no files what so ever... Same is true form the terminal window. The only obvious problem is that the Sharity GUI will now work, it begins to load and then the app quits. I noticed a post above mine and unstuffed the app with OpenUp, this way I was able to at least install as root, however the same thing happened with the app quitting.

In the Process viewer I see that Sharityd is running with user listed as "nobody" is this normal...?

any help would be appreciated, Tony

 
Back
Top