Video Screencast Help

Unix script to copy files to Macs

Created: 18 Feb 2013 • Updated: 18 Feb 2013 | 8 comments
This issue has been solved. See solution.

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.

Comments 8 CommentsJump to latest comment

joe.zeles's picture

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.

Joe Zeles - Sr. Systems Engineer

Intuitive Technology Group - Symantec Platinum Partner

Jason Gallas's picture

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.

joe.zeles's picture

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
 
 

Joe Zeles - Sr. Systems Engineer

Intuitive Technology Group - Symantec Platinum Partner

SOLUTION
Jason Gallas's picture

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?

joe.zeles's picture

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.

Joe Zeles - Sr. Systems Engineer

Intuitive Technology Group - Symantec Platinum Partner

joe.zeles's picture

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.

Joe Zeles - Sr. Systems Engineer

Intuitive Technology Group - Symantec Platinum Partner

Jason Gallas's picture

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!

joe.zeles's picture

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.

Joe Zeles - Sr. Systems Engineer

Intuitive Technology Group - Symantec Platinum Partner