Site TIPS PAGE🔎 SEARCH  Ξ INDEX  MAIN MENU  UP ONE LEVEL
 OJB's Web Site. Version 2.4. Mac Tip.Location: tip97 tips mac owen2 
Tip

Discuss   Up to OJB's Mac Tips List

Terminal: Changing Privileges

Sometimes you might not be able to use files or access directories (folders) in macOS (or OS X or Mac OS X) because you don't have sufficient privileges. This can be corrected using the "Ownership and Permissions" section of the Get Info dialog from the Finder, but it is often much faster and easier to make these changes from the command line, especially if you need to change a large number of files.

There are three main command involved in changing privileges, they are "chown", which changes the owner of a file, "chgrp", which changes the group associated with a file, and "chmod" which changes the "mode" or what different users can do with the file.

To display the current privileges associated with a file use the "ls -l" command. The first column should contain a cryptic collection of characters like "-rw-r--r--". The third column will contain the name of a user, such as "owen", and the fourth column will contain the name of a group, such as "staff".

For most of the files in your documents folder the owner will be the short name you set up when you first configured the system. The group will usually be one of the standard groups the system sets up, most often "staff". The other column is a bit trickier. It shows what access the the owner (user), group and other users have to the item.

For example, if the specification is "-rw-r--r--" it means the owner has read and write access (but not execute) as shown by "rw-" in characters 2 to 4 (ignore character 1 at this point). Characters 5 to 7 show the group's privileges, "r--" meaning read but no write or execute. Characters 8 to 10 show the access other users have, also just read. In other words, the owner (owen) can read and write (including change and delete) this file, the group (staff, usually a group containing all other users of that machine) and any other user not in that group can read it but can't change or delete it.

To change the owner of a file use "chown". For example to change the owner of a file "Stuff.txt" to "fred" type "chown fred Stuff.txt". To change the group use "chgrp". To set the group associated with the file to staff use "chgrp staff Stuff.txt". To specify what the user and group can do use "chmod". To give the owner read and write access, the group read only and other users no access, use "chmod u=rw,g=r,o= Stuff.txt".

Related Tips

Terminal Example: Listing Files
Terminal Example: Shell Script
Terminal Tips: Deleting Files
Terminal: Change Priority
Terminal: Fixing a Hang
Terminal: Listing Directory
Terminal: Manual and Help
Terminal: Remote Secure Login
Terminal: Terminate a Process
Terminal: Top Processes





I usually write a blog post about once a week. The latest post can be viewed here: Think for Yourself: In the end, everything is just an opinion. Be skeptical, and think for yourself! (posted 2026-04-25 at 21:12:02). Or go to the Home Page of My Blog to choose a post to view.

I do podcasts too! You can listen to my latest podcast, here: OJB's Podcast 2026-04-14 How Far is that Star?: How would we really know how big the universe is? Or subscribe to my podcast RSS feed, on my RSS Feeds page.

If you're not sure what to view from the thousands of pages on my site, here are some suggestions: My Latest Airshow Report (photos and movies from Warbirds Over Wanaka, 2026), My Favourite Wines and Beers (tasting notes for some of my favourites), An Interesting Astronomical Observation (learn a bit about astronomy from these observing notes), See Some Photos (A short rail journey through the Taieri Gorge), Read Some Mac Tips (Learn about how to use your Mac, and fix some problems).


Latest Site News and Notifications (Desktop): You are currently viewing OJB's web site, version 2.4 which has some major changes, and possibly errors! Please report any problems to ojb@mac.com.

 Site ©2026 by OJBOJB's BlogMicrosoft Free ZoneMade & Served on Mac 
Site Features: Blog RSS Feeds Podcasts Feedback Log07 Jun 2024. Hits: 1,001,533,787
Description: Mac TipLogged: nothingLoad Timer: 171ms