谁应该拥有 /var/log 和 /var/tmp

谁应该拥有 /var/log 和 /var/tmp

我正在玩弄我编写的一些脚本,我可能已将其所有者更改为 root,但我不确定。谁应该是这些文件夹的所有者?

答案1

总计/var/

drwxr-xr-x  2 root root     4096 jul 19 07:56 backups
drwxr-xr-x 18 root root     4096 mrt 29 07:51 cache
drwxrwsrwt  2 root whoopsie 4096 jul 19 07:35 crash
drwxr-xr-x 72 root root     4096 jul 19 10:14 lib
drwxrwsr-x  2 root staff    4096 feb 27 19:33 local
lrwxrwxrwx  1 root root        9 mrt 29 07:47 lock -> /run/lock
drwxrwxr-x 15 root syslog   4096 jul 19 07:56 log
drwxrwsr-x  2 root mail     4096 mrt 20 08:31 mail
drwxrwsrwt  2 root whoopsie 4096 mrt 20 08:37 metrics
drwxr-xr-x  2 root root     4096 mrt 20 08:31 opt
lrwxrwxrwx  1 root root        4 mrt 29 07:47 run -> /run
drwxr-xr-x  9 root root     4096 mrt 20 08:35 spool
drwxrwxrwt  2 root root     4096 jul 19 13:52 tmp

玩得开心

答案2

两者都应由 root 拥有,其组/var/log应为syslog,并且应具有全球可写性。

答案3

我还把所有的所有权和组都搞砸了/var/log。由于我有一个单独的 21.04 Ubuntu,它允许我确定它们应该是什么:

root   root      104003 Feb  1  2021 bootstrap.log
syslog adm            0 Aug 22 00:00 mail.err
root   root         573 Aug 25 21:54 fontconfig.log
root   adm            0 Sep  3 00:00 apport.log
root   root         162 Sep  9 15:25 alternatives.log
root   root       32064 Sep 13 17:30 faillog
syslog adm       109207 Sep 16 16:32 cloud-init-output.log
syslog adm      1943745 Sep 16 16:32 cloud-init.log
root   root       38778 Sep 16 19:03 dpkg.log
root   adm       764861 Sep 16 21:03 dmesg
root   root        6370 Sep 17 15:27 ubuntu-advantage.log
root   utmp     2783616 Sep 17 19:59 btmp
root   utmp      202752 Sep 17 20:06 wtmp
root   utmp      292584 Sep 17 20:06 lastlog
syslog adm          877 Sep 17 20:42 mail.log
syslog adm          977 Sep 17 20:48 auth.log
syslog adm        43183 Sep 17 20:50 ufw.log
syslog adm       422976 Sep 17 20:50 syslog
syslog adm        57150 Sep 17 20:50 kern.log

相关内容