Category filter
Script to change ownership of a file or folder on Mac
Every file or folder on Mac has an owner account assigned to it. Users can assign ownership of a file or folder to a specified user using the Get Info option. Right-click on the target file or folder to access the Get Info option from the dropdown menu. When configuring multiple endpoints, changing the file ownership can be tiresome for an IT admin. With Hexnode UEM, admins can remotely change ownership of the target file or folder on multiple endpoints simultaneously by running the Execute Custom Script action.
Scripting language – Bash
File extension – .sh
Change ownership of a file or folder
1 2 |
#!/bin/bash chown 'username' 'file path/file name with extension' |
For example:
chown BOB Desktop/Document.txt
The chown
command is used to change the owner of a specific file/folder. Keep in mind that the username
field represents the user account’s short name, which is typically the name of the home directory.