Posted on 08-24-2018 02:23 PM
I want to run a script on a Mac that is initiated by an item in Self Service.
Our user accounts are AD based, "Managed" and "Mobile" according to Users & Groups.
The script is going to create a folder on the user's desktop and then copy some log files to the folder.
I want the user to be be able to review the contents of the folder but, as created by the script, the user does not have permission to do so.
So: after the folder is created and populated, how do I chmod the folder so that it belongs to the user account? I'm able to get the userID and set it as the folder owner, but I have no idea what group to assign. Just changing the owner of the folder doesn't appear to give the user access to it. I'm doing something wrong, I just can't figure out what that is.
Can anyone offer some direction?
Solved! Go to Solution.
Posted on 08-24-2018 02:32 PM
This should do it:
#!/bin/bash
userName=""
folder="/Users/$userName/Desktop/FolderName"
chown -R "$userName" "$folderName"
exit 0
Posted on 08-24-2018 02:32 PM
This should do it:
#!/bin/bash
userName=""
folder="/Users/$userName/Desktop/FolderName"
chown -R "$userName" "$folderName"
exit 0
Posted on 08-24-2018 02:34 PM
If that does not work you can throw this at the end:
chmod 700 "$folderName"
Posted on 08-24-2018 03:01 PM
@ryan.ball thank you! It was the -R on the chown that did the trick!