How do I change ownership of a file in Mac OS X
Makradar Technologies / / December 19, 2019
Although such a problem, when you lose access to the file, is quite rare, yet it can happen, for example, when your rights are changed to third-party application.
Usually this problem by running the recovery process eliminates user rights (run Disk Utility from the folder / Applications / Utilities, select the section and click the Restore button access rights), but this is not always It works. To deal with the problem, you need to set permissions to the problematic files.
In such situations, you have two options: to change the permissions on the file (s) manually via Finder or via the terminal. We will consider both, although for advanced users is much easier and faster to use Terminal.
Change file permissions using the Finder
You can change the permissions of files through the window "Properties":
- Select the file in the Finder, then press Command + i, to trigger the window "Properties".
- Click on the arrow next to the "Sharing and Permissions" to find out who the owner of the file and look at the law.
- Select the lock icon to unlock the "Rights".
- Press the [+] button to add a new owner, and then select a user from the list and click "Select".
- Now, select the name and click the gear icon and selecting "Make (user name) owner."
Through Terminal recovery process is faster and, see, it's easier.
Change the file owner of the terminal with the chown
Using the Terminal, as a rule, it is considered a way for advanced users, but in some situations it works is not only faster, but easier.
To do this, we use the chown command, which is the standard for Mac OS X.
To begin, start Terminal from / Applications / Utilities /.
Syntax:
chown [username] [file]
Example usage: To change the owner of the file to «test-file.txt» User name «tanya» command would look like this:
chown tanya test-file.txt
Keep in mind that the username that you use - this is a short name for the account, which usually coincides with the name of the user folder.
If you are not sure that the short user name, enter 'Whoami' in the terminal for the current short name or type "ls / Users", to see a list of all user accounts on a current Mac.
If you change the rights on the system files or other users' files to which you do not have rights to read and write, you need to use the chown command with the 'sudo'.
sudo chown tanya ~ / Desktop / test-file.txt
To edit a group of files, use the chown colon after a short user name:
sudo chown tanya: staff ~ / Desktop / test-file.txt
The choice of which way to solve the problem, is always yours.
(via)