Remotely activating File Sharing on a headless Mac.

Posted:
in Genius Bar edited January 2014
Is there a terminal command to turn on file sharing? I need to activate sharing on a monitorless OS X box.

Comments

  • Reply 1 of 4
    thuh freakthuh freak Posts: 2,664member
    though a bit more convoluted than you were probably hoping, but you can install a vnc server onto the headless computer. then, vnc into it and turn on file sharing in the gui. vnc servers and clients are freely available at download.com and versiontracker.com, and are unnecessarily small and easy to use. i suggest you pick out a server that requires no gui interaction (perhaps play with it on a head'd computer first to find a match), then send it to the headless. then open the vncserver from the terminal. next open a vnc client on a head'd machine and connect to the headless.
  • Reply 2 of 4
    Quote:

    Originally posted by thuh Freak

    though a bit more convoluted than you were probably hoping, but you can install a vnc server onto the headless computer. then, vnc into it and turn on file sharing in the gui. vnc servers and clients are freely available at download.com and versiontracker.com, and are unnecessarily small and easy to use. i suggest you pick out a server that requires no gui interaction (perhaps play with it on a head'd computer first to find a match), then send it to the headless. then open the vncserver from the terminal. next open a vnc client on a head'd machine and connect to the headless.



    Thanks for the idea. If anyone knows of a command line option, that would be ideal.
  • Reply 3 of 4
    Ok, after a little experimentation, I figured-out how to activate it through the command line (though, because I currently don't have another computer to test it, I'm not sure if it works).



    Here's how you do it:



    1) SSH to your headless Mac

    2) type the following: sudo /System/Library/CoreServices/AppleFileServer

    3) enter your administrator password when prompted

    4) run "top" to make sure that "AppleFileServer" is in the list of processes

    5) If it is, then that should mean that file sharing is enabled





    To disable file sharing from the command line, do the following:



    1) run "top" from the command line

    2) find the PID number for the AppleFileSharing app and memorize it long enough for the next command

    3) type the following: sudo kill PID#

    (replace "PID#" with the number you got from Step 2)

    4) enter your administrator password when prompted

    5) run "top" again to make sure that the AppleFileServer app is no longer listed





    I hope this helps =)
  • Reply 4 of 4
    skalmanskalman Posts: 42member
    The Inevitable is almost right (at least it didn't work on my machines). To make it work I had to change his solution slightly.



    1. SSH to machine

    2. su

    3. cd /System/Library/CoreServices/AppleFileServer.app/Contents/MacOS/

    4. ./AppleFileServer
Sign In or Register to comment.