您的Mac包含用于保存个人数据和文档的文件和文件夹。为了保护您的文件并防止它们被窥探(protect your files and keep them secure from prying eyes),您可以使用密码或其他加密文件的方式,但 macOS 内置了一种默认方式。
macOS 上的磁盘权限(或目录权限)旨在防止其他用户和某些程序(prevent other users and certain programs from opening files)在您的Mac上打开文件并在未经许可的情况下修改它们。这样,您就可以放心地知道您的文件和文件夹是安全的。
如果您在Mac上遇到磁盘权限问题,本指南将介绍如何在 macOS 中修复或修复磁盘权限。
macOS 中的权限是什么以及它们如何工作?(What Are Permissions in macOS and How Do They Work?)
macOS 中的权限控制可以访问Mac(Mac)上的文件或文件夹的用户帐户。您可以在“信息(Info)”窗口底部的Finder中更改文件、文件夹或磁盘 的权限设置。
例如,您可以更改文件夹权限设置,以便您Mac上连接到它进行文件共享的其他用户只能查看但不能修改文件夹中的文件。
权限包括读、写和执行活动,可以由三种类型的用户编辑:所有者、组和使用计算机的每个人。
作为计算机的所有者,您可以使用权限为自己、组或每个用户定义单独的规则。这些权限包括文件或文件夹共享、文件访问权限和系统完整性。
如何在 macOS 上查看文件系统权限(How to View File System Permissions on macOS)
查看文件系统权限不仅限于计算机所有者。其他任何人也可以通过Finder(Finder)应用程序的信息(Info)窗口查看文件和文件夹权限。
查看文件或文件夹的权限:
- 右键单击文件或文件夹,然后从上下文菜单中选择获取信息。(Get Info)
- 选择共享和权限(Sharing & Permissions)以展开权限。
- 您会在权限字段中找到三种不同类型的用户(types of users in the permission fields):所有者、组和所有人。
- 所有者(Owner):项目的创建者或将其复制到计算机的人。
- 组(Group):一组加入的用户帐户,其权限适用于所有成员。
- 每个人(Everyone):定义任何人的访问权限,包括访客、本地和共享用户。
- 在每个用户帐户旁边,您会看到诸如Read、Read and Write、Execute或 No access 之类的权限。
- 读取权限(Read permissions):仅允许用户或组成员打开文件或浏览文件夹中的项目列表。他们无法保存对文件或文件夹的任何更改。
- 写入权限(Write permissions):允许用户或组成员修改或删除文件或文件夹。
- 执行权限(Execute permissions):对于文件,这意味着如果文件是脚本或程序,用户可以执行该文件。不是脚本或程序的文件不应启用执行权限。对于文件夹,这意味着只要启用读取权限,用户就可以打开该文件夹并查看文件。
为什么要在 macOS 中修复磁盘权限(Why You Should Repair Disk Permissions in macOS)
Mac上的每个文件和文件夹都有一组关联的权限。此外,您在Mac中安装的大部分东西都是从包文件(package files)中安装的,这些文件还存储了其他不会占用硬盘太多空间的文件。
包文件中包含材料清单文件 ( (Materials).bom(Bill) ),其中包含包已安装的文件列表以及每个文件的权限。
但是,可以修改这些文件权限,尤其是当您在Mac 上安装和卸载应用程序时(uninstalling apps on your Mac)。当权限受到影响时,Mac上的程序可能会更改和修改文件,这最终可能导致各种系统问题,例如冻结、滞后或崩溃(freezing, lagging or crashing)以及权限错误。
如果您发现 Mac 的性能发生了一些奇怪的变化(changes in your Mac’s performance)或应用程序无法正常运行,您应该首先解决磁盘权限问题。
幸运的是,如果您的Mac运行的是 macOS Mojave 10.14或更高版本,则添加到您的Mac的任何新应用程序都将请求获得使用某些功能的权限。如果您拒绝这些权限,这些应用程序可能无法正常运行,但会增加您数据的隐私和安全性。
在 macOS 中修复或修复磁盘权限可确保您的操作系统可以访问或修改特定文件。例如,光盘权限确保您可以启动Mac、登录您的帐户、打印或启动应用程序等等。
修复 macOS 上的磁盘权限还可以确保特定文件具有正确的权限,以防止不应干预这些文件的应用程序或用户进行未经授权的访问。
如何修复或修复 macOS 中的权限(How to Fix or Repair Permissions in macOS)
修复权限是一个标准的Mac故障排除技巧,似乎可以解决 macOS 上许多罕见类型的问题。但是,在OS X El Capitan 10.11(OS X El Capitan 10.11)发布后,该选项从Disk Utility应用程序中消失了。
Apple将该功能替换为系统完整性保护(System Integrity Protection)( SIP ),它可以防止潜在的恶意软件访问您计算机上的重要文件。
您仍然可以在 macOS 中修复磁盘权限,因为该选项现在是First Aid的一部分,它将多个操作捆绑在一起,以解决与磁盘驱动器相关的不同问题。
以下是检查和修复磁盘卷是否有任何错误的方法:
- 选择前往(Go)>实用程序(Utilities)>磁盘实用程序(Disk Utility)以打开磁盘实用程序。
- 接下来,在左窗格中 选择您的启动卷。(boot volume)
- 在窗口右上角 的磁盘工具(Disk Utility)工具栏中选择急救。(First Aid)
- 确认您选择了正确的驱动器,然后选择运行(Run)以启动磁盘修复过程。如果出现警告消息弹出窗口,请选择继续。(Continue)
在修复过程中,您的Mac不会响应任何输入,这是正常的和预期的。发生这种情况是因为 macOS 需要正确分析驱动器的内容,但只需几分钟即可完成。
修复过程完成后,您将获得一份报告,其中显示了该过程完成的所有内容。如果有任何严重错误,您将收到它发现的问题的通知。
重置主文件夹的权限(Reset Permissions for the Home Folder)
Mac上的主(Home)文件夹是您的用户文件夹,其中包含您经常访问的其他几个文件夹,例如桌面(Desktop)、应用程序(Applications)、文档(Documents)、下载(Downloads)等。
以下是如何重置主(Home)文件夹的权限以修复磁盘权限。
- 选择前往(Go)>主页(Home)。
- 接下来,选择文件(File)>获取信息(Get Info)。
- 选择共享和权限(Sharing & Permissions)以查看文件夹的权限。如果“共享(Sharing)和权限(Permissions)”部分未打开,请选择箭头将其展开。
- 接下来,选择锁定(Lock)按钮。
- 输入您的管理员名称(admin name)和密码(password)。
- 选择操作菜单(Action menu)>应用到封闭项目(Apply to enclosed items)。
- 接下来,选择确定(OK)以完成权限重置过程。进度条将出现在窗口顶部,更改将反映在整个主(Home)文件夹中。
- 进度条完成后,选择前往(Go)>实用程序(Utilities)>终端(Terminal)以打开终端。
- 键入或粘贴此命令:diskutil resetUserPermissions / ` id -u`将根卷 (/) 上的权限重置为当前用户 ID。
- 该过程完成后,退出终端(Terminal),然后重新启动Mac以使更改生效。
如果在 Mac 上重置权限时出现错误 69841,该怎么办(What to Do If You Get the Error 69841 While Resetting Permissions on a Mac)
有时重置根卷上的用户权限可能不会按计划进行。您可能会收到“错误 69841 用户主目录权限重置失败”消息。如果您收到此错误,请执行以下操作,具体取决于您的 macOS 版本。
在 macOS Mojave 或更新版本上(On macOS Mojave or newer versions)
- 选择Apple 菜单(Apple menu)>系统偏好设置(System Preferences)>安全和隐私(Security & Privacy)。
- 接下来,选择隐私(Privacy)选项卡,选择锁定(Lock)图标并输入您的管理员名称和密码。
- 选择全盘访问(Full Disk Access)选项卡,然后选择添加(Add)(+) 按钮。
- 搜索终端(Terminal)并将其添加到全盘访问。
- 打开终端(Terminal)并粘贴或键入以下命令:chflags -R nouchg ~。按回车键(Return)。
- 接下来,键入diskutil resetUserPermissions / `id -u\` 并按Return键。
- 重新启动Mac以使更改生效。
在 macOS High Sierra 或更早版本上(On macOS High Sierra or Earlier Versions)
与 macOS Mojave或更高版本不同,在解决(Mojave)Mac上的错误 69841 之前,您无需在macOS High Sierra或更早版本中将(macOS High Sierra)终端(Terminal)添加到全盘访问(Full Disk Access)。
- 打开终端(Terminal)并输入chflags -R nouchg ~。
- 接下来,键入diskutil resetUserPermissions / ìd -u` 并按Return。
- 重新启动Mac以使更改生效。
让您的 Mac 保持良好状态(Keep Your Mac in Good Shape)
仅当您怀疑存在文件或文件夹权限问题时,才应在 macOS 中修复或修复磁盘权限,尤其是在您经常安装和删除软件的情况下。也就是说,您需要小心下载到计算机上的软件。
我们还有其他指南可以帮助您解决Mac的问题,例如蓝牙无法在您的计算机上工作(Bluetooth isn’t working on your computer)、Mac 相机无法工作(Mac camera isn’t working)或Mac 无法进入睡眠状态(Mac won’t go to sleep)。
您(Were)是否能够使用本指南中的步骤修复或修复磁盘权限?在下面的评论中告诉(Tell)我们。
How to Fix or Repair Disk Permissions in macOS
Your Mac cоntains files and folders where you keep personal data and documents. In ordеr to protect your files and keep them secure from prying eyes, you can use a password or other means of encrypting the files, but there’s a default way that’s built into macOS for that.
Disk permissions (or directory permissions) on macOS are designed to prevent other users and certain programs from opening files on your Mac and modifying them without permission. This way, you can rest easy knowing your files and folders are secure.
If you’re having trouble with disk permissions on your Mac, this guide explains how to fix or repair disk permissions in macOS.
What Are Permissions in macOS and How Do They Work?
Permissions in macOS control the user accounts that can access the files or folders on your Mac. You can change the permission settings in Finder at the bottom of the Info window for a file, folder or disk.
For example, you can change folder permission settings such that other users on your Mac who connect to it for file sharing can only view but not modify the files in the folders.
The permissions, which consist of read, write and execute activities, can be edited by three types of users: the owner, a group, and everyone using the computer.
As the owner of the computer, you can use permissions to define separate rules for yourself, a group, or every user. These permissions include file or folder sharing, file access rights, and system integrity.
How to View File System Permissions on macOS
Viewing file system permissions isn’t limited to the owner of the computer. Anyone else can view the file and folder permissions through the Finder app’s Info window as well.
To see permissions of a file or folder:
- Right-click the file or folder and select Get Info from the context menu.
- Select Sharing & Permissions to expand the permissions.
- You’ll find three different types of users in the permission fields: Owner, group, and everyone.
- Owner: The creator of the item or the person who copied it to the computer.
- Group: A set of joined user accounts whose permissions apply to all members.
- Everyone: Defines access for anyone including guest, local, and sharing users.
- Next to each user account, you’ll see permissions such as Read, Read and Write, Execute, or No access.
- Read permissions: Allow the user or group members only to open a file or browse a list of items in a folder. They cannot save any changes to the file or folder.
- Write permissions: Allow the user or group members to modify or delete the file or folder.
- Execute permissions: For a file this means the user can execute the file if it’s a script or program. Files that aren’t a script or program shouldn’t have the execute permission enabled. For a folder, it means the user can open the folder and see the files so long as the read permission is enabled.
Why You Should Repair Disk Permissions in macOS
The files and folders on your Mac each have an associated set of permissions. In addition, most of the things you install in your Mac are installed from package files, which also store other files that don’t take too much space on your hard disk.
Within the package file are Bill of Materials files (.bom), which contain a list of files that the package has installed and the permissions for each file.
However, these file permissions can be modified, especially when you’re installing and uninstalling apps on your Mac. When the permissions are affected, programs on your Mac may alter and modify files, which could end up causing all sorts of system issues like freezing, lagging or crashing, and permission errors.
If you notice some strange changes in your Mac’s performance or apps aren’t working right, you should start by troubleshooting the disk permissions.
Fortunately, if your Mac is running macOS Mojave 10.14 or newer versions, any new apps added to your Mac will ask for permission to use some features. If you deny these permissions, the apps may not function properly, but it increases privacy and security for your data.
Fixing or repairing disk permissions in macOS ensures that your operating system can access or modify particular files. For example, disc permissions ensure that you can start up your Mac, log into your account, print or launch apps, and more.
Repairing disk permissions on macOS also ensures that particular files have the right permissions to prevent unauthorized access by apps or users that shouldn’t be meddling with those files.
How to Fix or Repair Permissions in macOS
Repairing permissions is a standard Mac troubleshooting tip that appears to solve many rare types of problems on macOS. However, the option disappeared from the Disk Utility app after the release of OS X El Capitan 10.11.
Apple replaced the feature with System Integrity Protection (SIP), which prevents potentially malicious software from accessing important files on your computer.
You can still repair disk permissions in macOS as the option is now part of First Aid, which bundles several actions together that resolve different issues related to the disk drive.
Here’s how to check and repair the disk volume for any errors:
- Select Go > Utilities > Disk Utility to open Disk Utility.
- Next, select your boot volume in the left pane.
- Select First Aid in the Disk Utility toolbar at the top right side of the window.
- Confirm that you selected the right drive, and then select Run to start the disk repair process. Select Continue if you get in the warning message popup.
While the repair process is in progress, your Mac won’t respond to any input, which is normal and expected. This happens because macOS needs to analyze the drive’s contents correctly but it won’t take more than a few minutes to complete.
Once the repair process is completed, you’ll get a report that displays everything the process accomplished. If there are any serious errors, you’ll be notified of the issues it finds.
Reset Permissions for the Home Folder
The Home folder on your Mac is your user folder, which contains several other folders you access frequently like Desktop, Applications, Documents, Downloads and more.
Here’s how to reset permissions for the Home folder to repair disk permissions.
- Select Go > Home.
- Next, select File > Get Info.
- Select Sharing & Permissions to view the folder’s permissions. If the Sharing & Permissions section isn’t open, select the arrow to expand it.
- Next, select the Lock button.
- Enter your admin name and password.
- Select the Action menu > Apply to enclosed items.
- Next, select OK to complete the permissions reset process. A progress bar will appear at the top of the window and the changes will be reflected throughout the Home folder.
- Once the progress bar completes, select Go > Utilities > Terminal to open Terminal.
- Type or paste this command: diskutil resetUserPermissions / ` id -u` to reset permissions on the root volume (/) to the current user ID.
- When the process completes, quit Terminal, and restart your Mac to effect the changes.
What to Do If You Get the Error 69841 While Resetting Permissions on a Mac
Sometimes resetting the user permission on the root volume may not go as planned. You may get the “error 69841 permissions reset on user home directory failed” message. If you get this error, here’s what to do depending on your macOS version.
On macOS Mojave or newer versions
- Select Apple menu > System Preferences > Security & Privacy.
- Next, select the Privacy tab, select the Lock icon and enter your admin name and password.
- Select the Full Disk Access tab and then select the Add (+) button.
- Search for Terminal and add it to Full Disk Access.
- Open Terminal and paste or type this command: chflags -R nouchg ~. Press Return.
- Next, type diskutil resetUserPermissions / `id -u\` and press the Return key.
- Restart your Mac to effect the changes.
On macOS High Sierra or Earlier Versions
Unlike macOS Mojave or later versions, you don’t need to add Terminal to Full Disk Access in macOS High Sierra or earlier versions before resolving the error 69841 on your Mac.
- Open Terminal and enter chflags -R nouchg ~.
- Next, type diskutil resetUserPermissions / ìd -u` and press Return.
- Restart your Mac to effect the changes.
Keep Your Mac in Good Shape
Fixing or repairing disk permissions in macOS should be done only if you suspect that you have file or folder permission issues, especially if you install and delete software frequently. That said, you need to be careful about the software you download to your computer.
We have other guides that can help you fix issues with your Mac such as when Bluetooth isn’t working on your computer, Mac camera isn’t working or your Mac won’t go to sleep.
Were you able to fix or repair disk permissions using the steps in this guide? Tell us about it in a comment below.