Controlling the AppleShare Server

Controlling the AppleShare Server

AppleShare is the Macintosh system for sharing files and disks across networks. Of course, you can activate AppleShare file sharing from the Sharing pane of System Preferences (on the Services tab) by selecting Personal File Sharing. But where's the fun in that?

The AppleShare file server listens on port 548. If you are using firewall software, make sure that access to port 548 is not blocked.

To activate AppleShare from the command line:

1.
Per the task "To change the /etc/hostconfig system-configuration file" above, become root, back up /etc/hostconfig , and edit the file using vi .

2.
Change the line that says

AFPSERVER=-NO-

to

AFPSERVER=-YES-

3.
Save your changes and quit the editor.

4.
Start AppleShare:

SystemStarter start AppleShare

AppleShare is now active.

5.
Stop being root:

exit

You should be back at your regular shell prompt.

Tip

  • If you want to keep AppleShare from starting at boot time, reverse the change you made in step 2 abovethat is, change AFPSERVER=-YES- back to AFPSERVER=-NO- .


You can turn AppleShare off from the GUI using the Services tab of the Sharing pane in System Preferences, which also allows you to activate it, and you can also shut it down from the command line.

Once Apple updates the AppleShare StartupItems script ( /System/Library/StartupItems/AppleShare/AppleShare ) to handle an argument of stop , you will be able to use that script to stop AppleShare. Until then, you can still do it with a few more steps. (As of Mac OS X 10.4.2, the AppleShare script still cannot stop or restart the AppleShare server.)

As with everything in Unix, there are many reasons for wanting to do something from the command line instead of through a graphical interface. For example, you might want to create a shell script to perform a task, or you might want to perform the task manually while logged in to your Mac at the command line from another machine on the Internet.

To shut down AppleShare from the command line:

1.
sudo killall AppleFileServer

That's it. The AppleFileServer stops.

The killall command will attempt to stop all processes whose name matches its argument, and whose UID matches the UID of the user running the command. So, unless you run the command as root, killall will only kill processes that you own. When run by root (as we did here using sudo ), killall will send a TERM signal to all processes whose name matches the argument. See "About Commands, Processes, and Jobs" in Chapter 2, "Using the Command Line," for more on processes and who owns them.

Next, you should verify that the process is really gone.

2.
ps -auxwww grep AppleFileServer

This should return only one linethe line for the grep process itselfbecause that line contains the string AppleFileServer .



Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

Similar book on Amazon

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