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.

Changing or Reset OS X Password

Changing or Reset OS X Password

Mac OS X Account Password

Changing or reset OS X password with Mac OS X can be a hassle and typically occurs after you installed or upgraded your Mac OS or when you are installing new software. Most of the time it boils down to not remembering your password since you haven’t used it in a while. Here are some basic solutions to either resetting your password to unlocking you user account.

Best Practices
As you know when you install Mac OS X or when you setup a new Macintosh you are prompted to create a main users account. This is the administrator account and the password associated with it is associated with the root account. Anytime you run into trouble you can boot in the root users with you main default password and perform repairs. Best practice in setting up a new Mac dictates that you should be setting up two accounts right from the start, the first will be your Admin, troubleshooting account, the other your user account, for day-to-day usage. That way if you run into trouble you can log into you main admin account without really jeopardizing your user account.

Resetting a User Account with Administrator Password
If you remember you password associated with you primary Administrator Account, the first (or only) one you set up, its simple to reset any standard or managed user’s password. Logged in as the Administrator open System Preferences (Applications > System Preferences) and click on Accounts located in the System row. Each account name will be labeled either as Admin, Standard or Managed. If the lock at the bottom of the window is locked click it to allow changes to be made to the Preferences. Follow these steps for changing a users password:

      1. Select the Users Name from the list.
      2. Click on Reset Password
      3. Enter the new password and click Reset Password.

Resetting an Administrator Password
If you can remember your Administrator Password or can access you Administrator Account you will have to reset it using the Install disk for your current operating system. Unfortunately you can not use a previous version as it the tools it comes with are not compatible. To reset the password you will need to do the following:

      1. Insert your Install Disk for you current OS version.
      2. Restart your Mac and hold down the “C” key before the Apple logo appears at startup.
      3. A window will appear asking what language you want to work in. Click the right arrow at the bottom.
      4. For earlier versions of OS X reset the password from the installer menu for Tiger and later ignore the Installation screen and click on Utilities from the Menu bar and select Reset Password…
      5. Choose your primary Hard Drive from the menu select Account. Here you have to be clear on what you want to do. If you reset the System Administrator account this is usually the root user, not just a Administrative User Account. Most of the time you are here because this is the one you need to reset. Select the user you want to Reset the Password for.
      6. Enter the new Password, click Save, and quit the Installer and Restart your Mac from the Hard Drive.

Don’t Have the Mac OS X Install Disk!
If you have “lost” your installation disk for your current Mac OS X version you are left with two options. One go out an buy one on ebay or borrow one or reset it using the Command Line. NOTE: You can only do this if you are running Mac OS 10.4 Tiger or later. Do not do this if you have FileVault enabled as it has the potential for loosing all your data.

      1. Note the shortname (ex: cberkeley) of the account you want to target. This is the same as the name of its home folder.
      2. Restart your computer.
      3. On startup before the Apple logo appears, hold Command-S. This will start up your Mac in Single User Mode.
      4. At the root prompt enter:

      :/ root# sh /etc/rc

      [press return]

      :/ root# passwd [yourusername]

      [press return]

      5. Now you will have to enter a new password twice. What you type won’t appear on screen, but it is begin entered.
      6. Once you have typed in the new password twice, enter:

      :/ root# reboot

      [press return]

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.