Byt*_*der 14 permissions home-directory
我经常看到用户试图解决问题并在某处阅读或只是尝试递归chown他们的主目录,有时甚至还会递归地将权限重置为类似rwxr-xr-x或类似的内容。
想象一下这样的所有者/权限大屠杀 - 是否存在需要特殊权限或 root 拥有才能使系统工作的关键文件/目录?
mur*_*uru 17
~必须由 root 拥有。如果软件要求您的主目录中的文件归另一个用户所有,则这是一个错误,应报告为错误。
除此之外,一个常见的案例涉及两个与安全相关的软件,它们需要对某些文件进行限制权限,即:
见man ssh,部分FILES:
~/.ssh/config
This is the per-user configuration file. The file format and
configuration options are described in ssh_config(5). Because of
the potential for abuse, this file must have strict permissions:
read/write for the user, and not writable by others. It may be
group-writable provided that the group in question contains only
the user.
~/.ssh/identity
~/.ssh/id_dsa
~/.ssh/id_ecdsa
~/.ssh/id_ed25519
~/.ssh/id_rsa
Contains the private key for authentication. These files contain
sensitive data and should be readable by the user but not acces?
sible by others (read/write/execute). ssh will simply ignore a
private key file if it is accessible by others. It is possible
to specify a passphrase when generating the key which will be
used to encrypt the sensitive part of this file using 3DES.
Run Code Online (Sandbox Code Playgroud)
其他文件如authorized_keys、known_hosts等应该只能由用户写入,但可以是全世界可读的。
~/.gnupg(和内容)应该只能由您访问。使用其他权限,GPG 会抱怨不安全的权限。
Rma*_*ano 11
通常,您家中的文件和目录应该归您所有。
我有一些奇怪的 root 拥有的文件,它们可能是执行sudo命令的结果;事实上,有一些程序在下面写东西$HOME(那些需要超级用户权限的行为良好的程序不应该这样做——结果是 root 获得了应该属于用户的文件的所有权)。
通常删除或重新拥有它们(取决于文件)不会产生问题,而且通常可以解决一些问题,例如臭名昭著的.Xauthority文件 --- 有时,在运行后sudo dconf-editor,您无法再修改配置中的内容。
关于特殊模式:
x意味着交叉的权利);.ssh必须是drwx------(0700) 和其中的私钥-rw-------(0600)Public共享目录,它可能应该是drwxr-xr-x(对任何人的读取权限)或drwxrwxrwt(具有写入权限和粘性位,用于启用写入)。......我想不出还有什么需要特殊对待的了。