用 chmod 600 把文件权限收紧到仅自己可读
让私钥、证件扫描件、含密钥的脚本等敏感文件只有你的账户可以读写。
运行 chmod 600 ~/Documents/secret.txt 使文件仅本人可读写;需要执行的脚本用 chmod 755 script.sh。
01命令
命令
$ chmod 600 ~/Documents/secret.txt # private: only you; chmod 755 script.sh makes it executable02作用说明
三位数字分别代表所有者/组/其他人,每位是 read=4、write=2、execute=1 的和。600(rw-,---,---)是私钥和个人文档的标准权限;普通文档用 644;755(rwx,r-x,r-x)是脚本和目录的惯例值。改完用 ls -l 检查结果。
03风险
!注意: FAT/exFAT 磁盘上权限不生效,且权限不等于加密——管理员仍可重设 ACL;真正的保密请用加密磁盘镜像。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- chmod - Change Access Permissions依据: Explains the octal permission model where 600 gives the owner read/write and no access to group/others, and 755 grants owner full plus group/others read+execute.
- chmod(1) man page依据: The chmod man page documents the absolute octal modes (e.g. 600, 755) built from owner/group/others read-write-execute bits.
最后验证: 2026-09-19 · 分类: 安全与隐私