Skip to main content
Question

Simple file copy to Mac using Jamf?


Forum|alt.badge.img+1

Jamf noob here, I need to copy a file to a single mac computer in the /library/application support folder using Jamf Pro.  I have a copy of the file.  

I have gone into settings- scripts and I'm trying to write a script with a simple CP terminal command, but how do I supply the file?  Do I need to create a package for that?  

I should mention that I am working from home on a PC and don't have access to a Mac at the moment.  So I think that means I can't use Composer?

5 replies

DBrowning
Forum|alt.badge.img+24
  • Esteemed Contributor
  • 668 replies
  • March 24, 2023

your best bet would be to made a dmg package from Composer and deploy the package.


AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • 2717 replies
  • March 24, 2023
  1. Place the file on your device in the directory you want.
  2. Open JAMF Composer, drag the files in to JAMF Composer and set the permissions and file ownership you want.
    1. You can make a .dmg or .pkg, it really does not matter for this kind of thing.
  3. Upload the .dmg or .pkg to JAMF
  4. Make a policy to deploy the .dmg or .pkg. 

jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • 744 replies
  • March 24, 2023

if the file is a config that is text you could do it all in a script.. if the file is binary.. best use above.. 


Forum|alt.badge.img+5
  • Contributor
  • 54 replies
  • March 24, 2023

While you CAN do this...  not really what Jamf is designed for.  Copy a file to 1,000 machines is a whole lot more in-line.

Yes, you would need to create a package, and then you'd need to upload your package and create a policy to deploy it. But if you're at home on a Windows machine, you don't have many options.


Forum|alt.badge.img+9
  • Contributor
  • 83 replies
  • March 25, 2023

If you are limited to using a windows machine and cannot create a proper pkg or dmg to deploy then I would suggest embedding the file you need to copy into a script.

If the file is a text file (or any text based format), you can simply use a here string to create a copy of the file on disk. For example,

#!/bin/zsh FILE_PATH="/Library/Application Support/your_file_name" cat <<"EOF" >${FILE_CONTENTS} {{Put your script here exactly as you would in a file.}} EOF echo -n "$FILE_CONTENTS" > "$FILE_PATH"

 

If the file you are copying is not text based then it gets a bit more complicated but still possible. See this post: How to embed a binary file in a bash shell script 

Once you have the script, you can past it directly into Jamf's UI and create a policy to run it on the machine. It's not an ideal solution, but it should get it done.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings