operating-system - 为未加密的文件设置密码
问题描述
我想用密码保护一个文件,但我不想加密它。
可能吗?
我正在使用 macOS。
解决方案
这是不可能的。您可以做的是限制对该文件的权限,例如:
chmod -rw /path/to/file # remove Read/Write permissions for every user
chmod ug+rw /path/to/file # grand persmission only to owner (user or group).
chown otherUser:otherGroup /path/to/file
要访问该文件,您需要切换用户上下文,例如通过sudo
或su
。
推荐阅读
- java - android WebView中的上传按钮不起作用
- woocommerce - 在 WooCommerce 的“我的帐户”页面上添加一个按钮以订购详细信息
- r - p-色散(maxmin)问题的最佳线性化?
- python - 如果未以形式给出值,则默认情况下不存储空值?
- r - 如何定义输出以显示在闪亮应用程序的屏幕上?
- php - Php将json签名保存为文件夹中的图像
- reactjs - 我们如何在 react.js pdf 文件中使用表格
- regex - 如何在 Google 表格的另一个字符串中找到一个字符串的确切出现次数?
- python - 如何在 Python 中重复正则表达式的特定部分?
- docker - Docker - 重复的挂载点