Place a hidden file in a Users Library folder

New Contributor III


What is the easiest way to drop a folder or a file in a users Library folder? I would like to drop a whole folder in, maybe a 1 MB folder, or just place a .file in a specific folder. The only catch is the folder needs to already exist with option 2, with option 1 it shouldn't matter.

I can use composer to make the DMG/PKG if needed or leave it as a folder/file.



Valued Contributor II

Personal opinion on the best 2 ways to skin this cat. IF YOU HAVE A WEB SERVER - YOU CAN DO OPTION 1. If not, Do Option 2.

Option 1: Make a script in your Jamf Pro Dashboard & Deploy it as a policy


#Creates Directory in Users Library
mkdir /Users/USER/Library/NewFolder

#Downloads File to Directory in Users Library
curl -o /Users/USER/Library/NewFolder/NewFile**NewFile**

#Hides the newly created directory in Users Library
chflags hidden /Users/USER/Library/NewFolder

#Dictate Files Owner & Permissions
chmod ### /Users/USER/Library/NewFolder/NewFile 
chown user:group /Users/USER/Library/NewFolder/NewFile

Option 2: Create a Package and deploy it in a policy.

Looking for a Jamf Managed Service Provider? Look no further than Rocketman

Virtual MacAdmins Monthly Meetup - First Friday, Every Month

New Contributor III

Thanks @Hugonaut