Endpoint Protection

 View Only
  • 1.  Unix script to copy files to Macs

    Posted Feb 18, 2013 02:26 PM

    I am new to Macs and thought this process would be fairly simple but it turns out it is not (for me at least).  I am attempting to copy a SyLink.xml file for SEP to our Mac clients.  This would allow us to turn an unmanaged Mac client to a managed one.  I would like an example script if anyone has one already of how to do this.



  • 2.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 02:43 PM

    There are a couple ways to do this with CMS.  The 'cheater' way would be to create a software resource for the xml file, and then have the install command (I'm not sure where the file needs to be installed, so f be something like:

    cp SyLink.xml /Library/Application\ Support/Symantec/SMC/SyLink.xml

    The other option would to mount a network share where the file is located, and then copy it from the network location to the local computer.  Something like:

     

    #!/bin/sh

     

    Server="<server fqdn>"
    SharedFolder="<Share Name on Server>"
    UserName="<username>"
    Pass="<password>"
     
    #Note that if your password contains special characters, you'll need to use their asci value replacement
    mount -t smbfs //$UserName:$Pass@$Server/$SharedFolder /Volumes/$SharedFolder
     
    #Having Spaces in the share name may also be an issue
    cp /Volumes/$SharedFolder/SyLink.xml /Library/Application\ Support/Symantec/SMC/SyLink.xml
     
     
     
    Let me know if either of these work, or if you would like any clarification.


  • 3.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 04:12 PM

    When I attempt this command I get the following error:

    mount: realpath /Volumes/ts$: No such file or directory

    When I manually map this drive using the smb:// command it works fine.



  • 4.  RE: Unix script to copy files to Macs
    Best Answer

    Posted Feb 18, 2013 04:30 PM

    ah yes, sorry, I forgot, before you mount the directory, you have to create it...

     

     

    Server="<server fqdn>"
    SharedFolder="<Share Name on Server>"
    UserName="<username>"
    Pass="<password>"
     
    #Note that if your password contains special characters, you'll need to use their asci value replacement
    mkdir /Volumes/$SharedFolder
    mount -t smbfs //$UserName:$Pass@$Server/$SharedFolder /Volumes/$SharedFolder
     
    #Having Spaces in the share name may also be an issue
    cp /Volumes/$SharedFolder/SyLink.xml /Library/Application\ Support/Symantec/SMC/SyLink.xml
     
     


  • 5.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 05:22 PM

    We are making progress!  I was able to manually mount the share using a putty command line window.  Now I need to do it in my actual script.  My password does contain special characters.  How would I go about inserting a ! and $ value for example?

     



  • 6.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 05:37 PM

    If for example, your password was 'Bacon!$good', you would change it to 'Bacon%21%24good'.  Find an ascii table, it will help you convert any special characters.



  • 7.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 06:10 PM

    Are you loading a NS 7 agent onto your macs?  If so, it wouldn't be hard to deploy through the SMP.  Using Putty to login to each machine would be tedious.



  • 8.  RE: Unix script to copy files to Macs

    Posted Feb 18, 2013 07:07 PM

    Yes I am.  It is in my experience best to test via a command line first though to ensure there are no errors which are sometimes harder to read when executing via the SMP.

    I got my script to work.  Thank you so much for your help!



  • 9.  RE: Unix script to copy files to Macs

    Posted Feb 19, 2013 12:21 AM

    It is a lot easier if you create a software package in the SMP, and then deploy it like a quick delivery task.  You could avoid the entire need to mount a share.  Instead, your install command would just be the act of copying the xml file.