Using unix terminal sudo chown and chgrp

Mac OS X Command Line

Using unix terminal ‘sudo [chown] and [chgrp]’

With a recent upgrade to Mac OS X 10.6 I was reminded of a problem that might happen if you migrate files from a previous system or if you have a second hard drive forcing you to correct OS X operating system by running with sudo [chown] and [chgrp] using Terminal. I have experienced this issue before when installing Mac OS X versions 10.0, 10.1, 10.2, 10.3 10.4 and 10.5. Mine was related to my second hard drive that I use for backing up video and image files. After the update I wanted to sort some Desktop items on my primary drive to the second drive (Macintosh HD2). A dialog appeared asking me to Authenticate. Once you Authenticate you will have to keep doing this for every item you move to this drive. This is a common issue and occurs even through your primary user (you) might still have the same short name, password or user level assigned. There are two things you can do to repair this.

Ignore Ownership
Using unix terminal sudo chown and chgrp
If your second drive requires you to Authenticate and you are the primary user of the drive you can have the drive ignore the ownership the the volume. Simply:

  1. 1. Select the drive.
  2. 2. Type Apple+I or go the the Finder menu and Select > Get Info.
  3. 3. At the bottom of the Info Inspector you will see a and check the check box for “Ignore ownership on this volume”.

Change Ownership with Command Line
If this doesn’t solve your issue you can also reassign permissions via command line. This works the best if you are the primary user of you Mac. To change Permission with Terminal you will have to Launch Terminal from the Applications > Utilities Folder. Next you will issue the following commands:

1. To change Owner

[ComputerName]:~ [username]$ sudo chown -R [username] /Volumes/[Hard Drive Name or Folder Path]

You will get the following response:

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type “man sudo” for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Enter your Password to Authenticate

2. To change Group

[ComputerName]:~ [username]$ sudo chgrp -R admin /Volumes/[Hard Drive Name or Folder Path]

You might be prompted for you password again but since you are doing this in the same session it might just approve and return you to your [ComputerName] and [username]. That’s it! Test it by dragging a file to the drive. If you have done this to a folder on your primary drive you might want to Repair Permissions using Applications > Utilities > Disk Utility. Click on Repair Permissions.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Mac Users Guide Forum

    It Seem There Is Something Wrong With BBLD Configuration, Please Check It.