Table of contents:

How to change the owner of a file in Mac OS X
How to change the owner of a file in Mac OS X
Anonim

Although such a problem, when you lose access to a file, is quite rare, it can still happen, for example, when your permissions are changed by a third-party application.

Usually this problem is eliminated by starting the process of restoring user rights (run Disk Utility from the / Programs / Utilities folder, select the partition and click on the Restore access rights button), but this does not always work. To deal with the problem, you need to configure the rights to problem files.

In such situations, you have two ways: to change the rights to the file (s) manually through the Finder or through the Terminal. We will consider both methods, although for advanced users it will be much easier and faster to use the Terminal.

Change file permissions using Finder

You can change file permissions through the Properties window:

  • Select the file in Finder, then press Command + i to bring up the Properties window.
  • Click the arrow next to Sharing and Permissions to see who owns the file and see the permissions.
  • Select the lock icon to unlock the "Rights".
  • Click the [+] button to add a new owner, then select a user from the list and click Select.
  • Now select a name and click on the gear icon by selecting Make (username) owner.
Screenshot 2013-05-31 at 12.34.34
Screenshot 2013-05-31 at 12.34.34

Through the Terminal, the recovery process is faster and, as you will see, easier.

Change file owner from Terminal with chown command

Using the Terminal is generally considered a way for advanced users, but in some situations it is not only faster, but also easier.

To do this, we use the chown command, which is standard for Mac OS X.

First, launch Terminal from / Programs / Utilities /.

Syntax:

chown [username] [file]

Usage example: to change the owner of a file named "test-file.txt" for user "tanya" the command would look like this:

chown tanya test-file.txt

Keep in mind that the username you will be using is the short account name, which is usually the same as the name in the user folder.

If you are not sure if the short username is correct, enter ‘Whoami’ in Terminal to get the current short name or type “ls / Users” to see a list of all user accounts on the current Mac.

If you change the permissions on system files or files of other users to which you do not have read / write permissions, then you will need to use the chown command along with ‘sudo’.

sudo chown tanya ~ / Desktop / test-file.txt

To change the group of files, use chown with a colon after the short username:

sudo chown tanya: staff ~ / Desktop / test-file.txt

The choice of how to solve the problem is always yours.

Recommended: