Categories
Design

How to set file permissions on mac

@bsovvy
May 12, 2020, 8:30 am EST | 4 min read

How to set file permissions on mac

Like all major operating systems, macOS allows you to restrict access to files using a complex set of file permissions. You can set these yourself using the Finder app, or by using the chmod command in your Mac’s terminal. Here’s how.

Setting Mac File Permissions Using Finder

If you want to set the permissions for a file on your Mac without using the terminal, you’ll need to use the Finder app.

You can launch Finder from the Dock at the bottom of your screen. The application is represented by the smiling Happy Mac logo icon.

In a Finder window, you can view and set permissions by right clicking a file or folder and selecting the “Get Info” option.

How to set file permissions on mac

Extensive information about your file or folder can be found in the “Info” window that opens. To set file permissions, however, you’ll need to click on the arrow next to the “Sharing & Permissions” option.

This will display a list of accounts or user groups on your Mac, with access levels shown under the “Privilege” category.

How to set file permissions on mac

If the account or user group you want to set permissions for isn’t listed, select the Plus (+) icon at the bottom of the window.

How to set file permissions on mac

Choose the user or group in the selection window and then click the “Select” button. This will add it to the list.

How to set file permissions on mac

The access levels are self-explanatory—users with a “Read Only” access level are unable to edit files, but they can access them. If an account is set to the “Read & Write” level, then they can do both.

To edit this for a user or group in the list, click on the arrow next to the existing level for that account or group and then select either “Read Only” or “Read & Write” from the list.

How to set file permissions on mac

Permissions are immediately set. Close the “Info” window once you’re done.

Setting Mac File Permissions Using the Terminal

If you’ve ever used the chmod command on Linux, then you’ll be aware of its power. With one terminal command, you can set the read, write, and executable permissions for files and directories.

The chmod command isn’t a Linux-only command, however. Like many other Linux terminal commands, chmod dates back to Unix from the 1970s—Linux and macOS both share this heritage, which is why the chmod command is available in macOS today.

To use chmod , open a terminal window. You can do this by pressing the Launchpad icon on the Dock and clicking the “Terminal” option in the “Other” folder.

How to set file permissions on mac

Alternatively, you can use Apple’s built-in Spotlight Search feature to open the Terminal.

Viewing Current File Permissions

To view current permissions for a file, type:

Replace “file.txt” with your own file name. This will show all user access levels, as well as any extended attributes relevant to macOS.

How to set file permissions on mac

File permissions for the file are shown in the first 11 characters output by the ls command. The first character, an en dash ( – ), shows that this is a file. For folders, this is replaced by a letter ( d ) instead.

The next nine characters are split into groups of three.

The first group shows the access levels for the file/folder owner (1), the middle group shows group permissions (2), and the final three shows permissions for any other users (3).

How to set file permissions on mac

You’ll see letters here, too, such as r (read), w (write), and x (execute). These levels are always shown in that order, so for instance:

  • — would mean no read or write access, and the file isn’t executable.
  • r– would mean the file can be read, but not written to, and the file isn’t executable.
  • rw- would mean the file can be read and written to, but the file isn’t executable.
  • r-x means the file can be read and executed, but not written to.
  • rwx means the file can be read, written, and executed.

If the final character is an at sign ( @ ), then it signifies that the file or folder has extended file attributes relating to security, giving certain apps (like Finder) persistent file access.

This is related in part to new security features introduced in macOS Catalina, although file access control lists (ACLs) have been a Mac feature since macOS X 10.4 Tiger back in 2005.

Setting File Permissions

To set file permissions, you’ll use the chmod command at the terminal. To remove all existing permissions, set read and write access for the user while allowing read access for all other users, type:

The u flag sets the permissions for the file owner, g refers to the user group, while o refers to all other users. The use of an equal sign ( = ) wipes all previous permissions for that category.

In this instance, the file owner is gaining read and write access, while the user group and other users are gaining read access.

You can use a plus sign ( + ) to add access to a user level. For instance:

This would grant all other users both read and write access to the file.

You can use the minus ( – ) to remove this instead, for example:

This would remove read and write access for all other users from the file.

To wipe, add, or remove user permissions for all users, use the a flag instead. For instance:

This would grant all users and user groups with read and write access to your file, as well as allow all users to execute the file.

With great power comes great responsibility, and there’s no denying that the chmod command is an extensive and powerful tool to change file permissions on Mac. You can, for instance, replace the letters ( rwx ) with a combination of three (or four) octal digits, up to 777 (for read, write, and execute).

If you want to learn more about it, type man chmod at the terminal to read the full list of available flags and settings.

Every item on your Mac, whether it’s a file or folder, has a set of permissions. Those determine who can view and modify data on your computer. If at some point you need to restrict access to some of your files, you can easily do that by changing permissions.

In this article, we’ll show you how to view and change file permissions, as well as how to stay in control of your application permissions. Let’s start!

What permission types are on Mac?

There are several types of permissions users can have on macOS:

  • Read only — Allows a user to open the file, but not change it.
  • Write only — Makes a folder into a drop box. A user can copy items to the drop box, but cannot open it. Only the owner of the drop box can open it.
  • Read & Write — Allows a user to open the file and change it.
  • No Access — Blocks access to the file.

How to view file permissions

Any user can view the file permissions using the Finder’s Info window. In Finder, right-click the file or folder and choose Get Info from the menu. Click the Sharing & Permissions triangle to see the item permissions.

How to change permissions for files, folders, or disks

The next step is to actually change the item permissions to whatever you want. Below are a few examples of how you can adjust permissions to your needs.

Assign permissions to users and groups

  1. On your Mac, choose a file or folder.
  2. Right-click it and select Get info.
  3. Click the disclosure triangle in the Sharing & Permissions block.
  4. Click the lock icon to unlock it.
  5. Enter the administrator name and password.
  6. Choose the user in the Name column and then choose Privilege setting from the pop-up menu.

Apply permissions to all files in a folder/disk

  1. Choose a folder or disk.
  2. Select File > Get Info.
  3. Click the lock icon to unlock it.
  4. Enter the administrator password.
  5. Click the Action pop-up menu and choose Apply to enclosed items.

Change a file’s owner

  1. On your Mac, choose the file.
  2. Click the lock icon to unlock it.
  3. Enter the administrator password.
  4. If the new owner’s name is not listed in the Name column in the Sharing & Permissions block, click the Add button to add the new owner.
  5. Choose the new owner in the Name column, click the Action pop-up menu, then choose Make_the owner.

How to control application permissions

The latest macOS versions introduced new security controls. Now apps have to request permission before accessing certain parts of your drive. For example, if you open Skype for the first time, you’ll get a pop-up asking permission to access your camera and microphone.

You can easily check what programs are allowed to use your webcam, microphone, files and folders. There are two ways to do that — via System Preferences or using a third-party app like CleanMyMac X.

Change app permissions via System Preferences

If you have a strange feeling that someone is watching or listening to you, you can check what apps have access to your camera or microphone. Here’s how to do that:

  1. Go to the Apple menu.
  2. Choose System Preferences > Security & Privacy.
  3. Select the Privacy tab.
  4. Choose Camera from the left menu.
  5. Check what apps are allowed to use your camera.
  6. Uncheck the box next to the apps you don’t want have access to your camera.

Note:

You can limit access to your camera or microphone only for third-party apps. Apple apps and bundled system apps will not show up in the camera access control list. So, for example, you won’t see FaceTime in the app permissions panel.

Control all permissions easily with CleanMyMac X

If you don’t feel like browsing your System Preferences in search of app permissions, there is an easier and faster way to manage them. Get yourself the app CleanMyMac X and use its freshly-baked feature “Application Permissions.” You’ll be able to view and manage all permissions from one place, in a matter of seconds.

Here’s how it works:

  1. Download and install CleanMyMac X (it has a free trial version)
  2. Launch the app.
  3. Go to the Privacy module.
  4. Click Scan.
  5. Choose Application Permissions.
  6. Check your permissions and adjust the ones you want.

As simple as that!

As long as you’ve already installed CleanMyMac X, we recommend you trying its other tools. Start from Smart Scan — a one-button solution for checking your Mac for unneeded junk files, viruses, and suitable speedup tasks.

That’s it. Now you know everything about permissions on your Mac and can adjust the settings to your personal needs. May your personal data be always safe and untouched!

Working remotely has dramatically changed the way we keep in touch and share information. Now, more than ever, we rely on technology to get the work done. There are a number of useful functions that help us with that but staying in control of our data is probably the most important one. For instance, who can access and change files and folders on a computer depends on the permission settings.

Mac users can change these permission settings in the Finder, when they go to the bottom of the Information window of a given file, folder, or disk. This functionality is especially useful when you want to allow other users who log in to your Mac computer, or connect for file sharing, to view specific files and folders but, at the same time, want to restrict them from making changes or viewing other files and folders that you don’t want to share with them.

If you want to learn more about these settings and how to use them, on this page, we have prepared quick instructions that will help you.

How to set file permissions on mac

Enable users and groups permissions

  1. Firstly, choose a drive, folder, or file on your Mac.
  2. To change its permissions, select File > Get Info.
  3. If you do not see the details in Sharing & Permissions, press the arrow
  4. Look at the bottom right and if you see a padlock icon there, click it to unlock the Get Info options. You may need to enter your administrator password and username for that.
  5. In the Name column, select a user or group. After that, from the pop-up menu that appears, you have to choose a privilege setting from one of the following:
    1. Read & Write – this setting gives permission to the selected user/group to open a file/folder and make changes to it.
    1. Read-only – this setting allows the selected user/group to only open a file/folder but not to make any changes to its content.
    1. Write only (Drop Box) – this setting makes a folder into a drop box where the selected user/group can copy items to the drop box but are not allowed to open it. The owner of the drop box is the only one who has permission to open it.
    1. No access – this setting restricts all access to the selected file/folder or disk.

Mac users can undo the changes made to the privilege settings for a specific user or a group when they navigate to the Get Info window and select the Sharing & Permissions section. Select the Action menu (a three dots icon), and click on “Revert changes” before closing the Info window.

How to set permissions to all files in a given folder or the entire disk?

  1. Similar to what you did above, start with choosing a folder or disk on your Mac, then select File > Get Info.
  2. Take a look at the padlock icon at the bottom and if it is locked, click on it to unlock the Get Info option. You will be asked to type in your administrator’s password and name.
  3. Next, select the Action pop-up menu (the three dots icon) and click on the option that says “Apply to enclosed items”.

How to change the owner of a given file, folder or disk?

  1. You need to highlight the file, folder, or disk that you want on your Mac and then select File > Get Info. In case the padlock icon at the bottom right is locked, click it to activate the Get Info options, then type your admin name and password.
  2. If the name of the new owner is not specified in the Name column found in Sharing and Permissions, please press Add icon and add the new owner’s name.
  3. Then, select the name of the new owner that you’ve just added from the Name column, click on the Action pop-up menu and then choose the option that says “Make __ the owner”.

You can revert any modifications made to an item’s owner in the Sharing & Permissions section found in the Get Info window. Click the Action pop-up menu, and pick “Revert changes” before shutting the Info window.

How to remove or add a user or group in the Name column?

  1. Again, choose a file, folder, or disk on your Mac, and then select File > Get Info. (Pay attention to the padlock icon at the bottom right and if it is locked, click it to activate the Get Info options on your Mac computer. Enter admin name and password if required.
  2. Navigate to Sharing & Permissions section and then do this:
    1. For adding a user or group: Click the Add icon below the Name list, highlight a user or group that you want to add, and then click on the Select button.
    1. For removing a user or group: Highlight the user or group that you want to remove, and then click on the “Remove” button that is found below the Name list.

Undoing the changes is easy from the Sharing & Permissions section of the Get Info window. Simply select the Action pop-up menu and tap on “Revert changes” before you close the Info window.

Generally, with the help of these instructions, you can fully control who accesses and modifies the items that you keep in your Mac computer. They come in handy when you share access to different files, folders, or disks, or let other people log in to your device.

Mac OS X uses permissions to restrict access to applications, files, and folders. Utilizing this security control can help protect your data from unauthorized access. Whether you use your Mac in public places or share it with other users, you may want to change the permissions on your documents to ensure the confidentiality and integrity of your data.

Of course, it can be difficult to strike a balance between convenience and security when using permissions. Users who are too restricted won’t be able to perform basic tasks. And if you give users too much power, you risk privilege escalation or worse. Use trial and error to find an adequate level of security that everyone can live with.

File Permissions Crash Course

Every file and folder on your Mac has a configurable set of permissions. Permissions control three types of access: reading, writing, and executing. You can mix and match any of the types to grant seven levels of access, as illustrated below. Read, write, and execute permissions overlap to create seven octal permission notations.

How to set file permissions on mac

You’ll learn how to modify permissions using the Info window in the next section. But to really leverage permissions, you need to learn the Unix-based symbolic and octal permission notations, which are hidden beneath the Mac OS X graphical user interface. All of the available permissions are shown in the table below.

Permissions No permission Execute Write Write and execute Read Read and execute Read and write Read, write and execute
Octal Notation 0 1 2 3 4 5 6 7
Symbolic notation –x -w- -wx r– r-x rw- rwx

The Terminal application allows you to use octal notation to set permissions for the owner, a group, and everyone else. To create a “write only” drop box folder, you could set directory permissions to 622 to give the owner read and write permissions, and the group and everyone else write only permissions. The three groups of notations are shown below.

How to set file permissions on mac

Mac OS X automatically sets permissions to limit a user’s access to system files and other user directories. If that protection isn’t good enough, you can change permissions to prevent other users from doing stuff like editing your “Great American Novel,” reading private financial documents, or opening a specific application.

How to Modify Permissions with the Info Window

The Info window allows you to modify permissions for users, groups, and everyone else. It doesn’t provide the same level of granular control as the chmod command, which you’ll learn about in the next section, but it’s a good way to quickly limit access to a file or folder.

Here’s how to modify permissions with the Info window:

Click a file or folder to select it.

From the File menu, select Get Info. One of the windows shown below appears.

How to set file permissions on mac

How to set file permissions on mac

Click the disclosure triangle next to Sharing & Permissions to display permissions for the selected file or folder.

Click the lock and authenticate with an administrator account.

Use the menus next to users and groups to change the permissions.

When you’re finished, close the Info window.

Changes are effective immediately.

How to Modify Permissions with chmod

For total control over permissions, you can use two Unix commands – ls and chmod – to display permissions and modify them. Assume you want to find a folder’s current permissions and then change them to 755. This would give you as the owner read, write and execute permissions, and everyone else read and execute permissions.

Here’s how to find a folder’s current permissions and change them:

Open the Terminal application.

Type ls –l , and then press Return. The symbolic permissions of the files and folders in your home directory are displayed, as shown below.

How to set file permissions on mac

Type chmod 755 foldername , and then press Return. This changes the permissions of the folder to rwxr-xr-x.

When it comes to using the ls and chmod commands, practice makes perfect. Try modifying the permissions on a couple of sample files. If you need more help, use the man command to display the manual pages for these commands (e.g., man ls ).

Final Thoughts

Permissions as a security control are more effective in some environments than others. Schools and offices have a real need for permissions – there are lots of users, and the information stored on the computers can be valuable. In single-user households, where only one person uses a Mac, convenience might outweigh any perceived security threats. It’s all about finding the right balance for your environment.

Related Articles

  • How to Enable the Root User on a Mac
  • How to Create User Accounts in Mac OS X

Subscribe to our email newsletter

Sign up and get Macinstruct’s tutorials delivered to your inbox. No spam, promise!

How to set file permissions on mac

Let’s review the types of permissions you can choose from in Mac X and Unix

It is important to note that Mac X 10.11 by default sets permissions to limit the logged in user to access to file and system directories. If something requires you to specify octal notation on a file folder, you do so using Mac X Terminal. Let’s get started.

1. Open Mac X Terminal

2. Let’s get into the directory of files we want to change permissions to. In this example, we change directory to /opt/X11

3. Type cd into Terminal and drag the folder or file(s) you want to change permissions on by dragging it into Terminal window. This is an easy way to the path to copy into Terminal without having to type it.

4. Now that we are in the folder we want, type ls –l to reveal all sub files and folders and their permissions.

How to set file permissions on mac

6. Example: chmod 755 /bin which gives bin folder Read/Write/Excute or rwxr-xr-x

You can set permissions on your MacBook to increase the security of your documents and to prevent yourself from inadvertently deleting files. To set permissions, follow these steps:

Click the item to select it, press Command+I (or choose Finder→File), and then choose the Get Info menu item.

Alternatively, you can right-click the item and choose Get Info instead. Either way, Mac OS X displays the Info dialog.

Click the right-facing arrow next to the Sharing & Permissions heading to expand it.

How to set file permissions on mac

To change your own permissions on the item, click the Privilege pop-up menu next to your name — handily marked “(Me)” as well — and choose a new Ownership permissions level.

This is likely set to Read & Write, and it’s a good idea to leave it alone. If you’re the file’s owner, you’re likely not a security risk.

Never choose an access level for yourself other than Read & Write without being absolutely sure of what you’re doing, because you can potentially prevent yourself from accessing or deleting the file in the future!

For example, if you simply want to lock an item to prevent changes being made, don’t set your Ownership permission to Read Only. (Instead, select the Locked check box in the General section of the Info dialog instead . . . you can easily clear the Locked check box later to make changes to the item.)

To change permissions for someone else or a group, click the Privilege value for that user or group and then choose the appropriate value from the pop-up menu.

Assigning permissions for an entire group is a good idea for limiting specific files and folders to only Administrator access. (Note, however, that Lion reserves the group name wheel for internal tasks, so never alter any permissions for the wheel group.)

If necessary, set the permission for the Everyone pop-up menu (otherwise known as “I’m going to lump everyone else into this category”).

If a user isn’t the owner of an item and doesn’t fit into any group that you’ve selected, this access permission setting for this file applies to that user.

Need to apply the same permissions to all the contents of a folder — including subfolders within it? If you selected a folder, you can click the Action button at the bottom of the Info dialog (which carries a gear icon) and choose Apply To Enclosed Items from the pop-up menu that appears.

After you confirm the action, Lion automatically changes the permissions for all the items contained in the folder to the same settings.

Generally, it’s a good idea not to override the permissions for all the items in a folder, so use the Apply to Enclosed Items function only when necessary.

After all the permissions are correct, click the Close button to save your changes and return to your friendly Finder.

If a specific user or group doesn’t appear already in the Privilege list, click the Add button (bearing the plus sign) and you can add a specific privilege level for that user or group. You can also delete a privilege level: Click the desired entry to select it and click the Delete button (which bears a minus sign).

某些 Creative Cloud 应用程序、服务和功能在中国不可用。

Problem

With macOS 10.15 Catalina, a new permissions dialog is displayed whenever Acrobat DC or Reader DC tries to read or write any folder on the drive.

How to set file permissions on mac

Solution

To allow Acrobat or Reader to write or read the folders on the drive, do the following.

In the Mac permissions dialog box, click OK.

The Security Preferences dialog is displayed. Choose to enable the folder permissions for Acrobat or Reader.

How to set file permissions on mac

If you click, Dont’ Allow, the following dialog is shown by Acrobat DC or Reader DC.

How to set file permissions on mac

To allow Acrobat DC or Reader DC to read or write folders on the drive, click OK. Choose to enable the folder permissions for Acrobat DC or Reader DC in the Mac Security Preferences dialog.

If you click Not Now, Acrobat DC or Reader DC access to folders on your drive will be blocked and the information saved in the Mac security preference.

Mac OS X Snow Leopard lets you set permissions on files you own that determine who can access those files. The combination of privileges, ownership, and group determines who can do what with the file. Four possible actions are allowed through permissions: Read-only, Read & Write, Write Only (Drop box), and No Access.

When you (or the person with the administrator account on your Mac) created your user account, you were automatically granted ownership of your Home folder and everything that it contains as well as any files or folders that you store in the Shared folder or another user’s Public folder.

To set permissions, follow these steps:

Click the item to select it, press Command+I (or choose Finder→File and then choose the Get Info menu item).

If you have a mouse or trackball with a right button, you can right-click the item and choose Get Info instead. Either way, Mac OS X displays the Info dialog.

Click the right-facing arrow next to the Sharing & Permissions heading.

The Sharing & Permissions settings expand.

How to set file permissions on mac

To change your own permissions on the item, click the You Can pop-up menu and choose a new Ownership permissions level.

This is likely set to Read & Write, and it’s a good idea to leave it alone. If you’re the file’s owner, you’re likely not a security risk.

Never choose an access level for yourself other than Read & Write without being absolutely sure of what you’re doing, because you can potentially prevent yourself from accessing or deleting the file in the future! If you simply want to lock an item to prevent changes being made, select the Locked check box in the General section of the Info dialog. You can easily clear the Locked check box later to make changes to the item.

To change permissions for someone else or a group, click the Privilege value for that user or group and then choose the appropriate value from the pop-up list.

Assigning permissions for an entire group is a good idea for limiting specific files and folders to only Administrator access. (Note, however, that Snow Leopard reserves the group name wheel for internal tasks, so never alter any permissions for the wheel group.)

If necessary, set the permission for the Others pop-up menu.

If a user isn’t the owner of an item and doesn’t fit into any group that you’ve selected, this access permission setting for this file applies to that user.

If you’re setting permissions for a folder, Snow Leopard can automatically change the permissions for all the items contained in the folder to the same settings. Click the Apply Enclosed button, and Mac OS X displays a confirmation dialog.

Generally, it’s a good idea not to override the permissions for all the items in a folder, so click the Apply Enclosed button only when necessary.

After all the permissions are correct, click the Close button.

This saves your changes and returns you to your friendly Finder.

If a specific user or group doesn’t appear already in the Privilege list, click the Add button (bearing the plus sign) and you can add a specific privilege level for that user or group. You can also delete a privilege level: Click the desired entry to select it and click the Delete button (which bears a minus sign).

Command line users are likely familiar with using chmod to set file permissions in numerical or octal format, for example running a command like ‘chmod 755 filename’, but have you ever wondered how you can get file permissions in octal format?

If you want to see or view the octal numerical value of permissions of any file or folder via the command line, you can turn to the stat command in Mac OS to do so.

We’re assuming you have a reasonable level of experience and comfort at the command line, if you don’t then this article likely isn’t relevant to you. Most Mac users will only ever view or change file permissions through the Mac Finder as described elsewhere (if even that), whereas this particular article is aimed at more advanced users.

How to Get Numerical chmod Permissions Values on the Mac

To get started, launch the Terminal app from /Applications/ on the Mac and use the following commands:

stat -f %A file.txt

For example, that command may output something like the following:

$ stat -f %A wget-1.18.tar.gz
644

Where, in this example, ‘644’ is the octal value of that files permissions.

Alternatively, you can use -f and %OLp (yes that’s an upper case ‘o’ and not a zero), the output will be the same assuming the file is too:

stat -f %OLp /Applications/System\ Preferences.app

Example output for that command may look like the following, showing the numerical octal value permissions for the target item:

$ stat -f “%OLp” ‘/Applications/System Preferences.app’
775

In this example, the “System Preferences” application has a octal permissions value of 775.

You should not need to use quotations, though if you need for some reason to escape a file name or path, or for scripting purposes, they’re easy to place like so:

stat -f “%OLp” ‘/Applications/System Preferences.app’

The -f flag is for format, you can read more about specific formatting options for the stat output from the manual page on stat with ‘man stat’.

In the latter command case, the “O” (upper case o) is specifically for achieving octal output.

Knowing the exact numerical permissions of a file or folder is wildly useful for so many reasons, and it can be helpful to know this if you’re adjusting the permissions of various items, or even if you’re moving files on the Mac and want to maintain the exact permissions and to verify it after the fact. There are countless other uses as well, particularly if you’re running a server of any sort from the Mac.

These commands should work the same for retrieving octal permissions in just about any version of macOS, MacOS, or Mac OS X, regardless of how the naming convention is capitalized. Notably however, is that the approach to getting octal permissions on the Mac is different from the rest of the Linux world, thus if you’re coming to the Mac from the Linux world you’ll need to adjust the stat command flags to accurately get the permissions in octal format, we’ll cover that quickly next.

Getting Octal File Permissions from Command Line in Linux

For the sake of being thorough, we’ll briefly discuss getting octal permissions values in the Linux world as well, where you can use the following to get the octal file permissions:

stat -c “%a %n” /Path/To/File

You can also more simply use the stat -c command:

stat -c %a /Path/To/File.txt

The numerical value output will be the same regardless, as long as the inputted target file is the same of course.

Again, these latter two approaches are linux specific, and you’ll need to use the methods outlined further above to get octal values of permissions of a file in Mac OS.

Do you know of any other methods or approaches to retrieving the numerical value of file permissions on a Mac? Share them in the comments below!