/var 文件夹的默认用户组所有者

/var 文件夹的默认用户组所有者

/var不幸的是,我错过了并突然改变了整个文件夹内容的权限(chown -R www-data:www-data ../../但我在里面/var/www_virthost/mydomain),我猜是什么问题;)

但问题是我不记得下一个文件夹的所有者/组是谁

backups
cache
crash
lib
lob
local
lock -> /run/lock
log
mail
opt
run -> /run
spool
tmp
www

谢谢

答案1

/var/可能是整个操作系统中最复杂的所有权设置。它并非全部由 root 拥有,这样做的危害与让用户拥有一切一样大。如果保持这种状态,有些东西将无法正常工作,即桌面。

如果你想查看正在处理的用户和所有者的数组,请查看以下命令在职的系统:

sudo ls -lR /var | awk '/^[^/]/ {print $3 " " $4}' | sort -u

在我的系统上,59清楚的用户/所有者组合/var/。我估计大多数人都会在这时候放弃并重新安装。说实话,如果你还没有到目前为止,您的计算机都已安装完毕,因此不会因安装不当而造成太大损失。而且几乎可以肯定安装速度会更快。

如果你还在读这篇文章,那说明你完全疯了,但你也有同感。让我们从拥有一切开始吧root:root

sudo chown -R root: /var

现在我们必须纠正那些不是 root 且不能被 root 执行的内容。我编写了一个简短的命令,它显示了不是由 root:root 拥有。

在输出中,我删除了一些与很多人不相关的内容(nginx、rabbitmq、schroot 内容、lxc 等等)。这些都是专业内容。如果您已经破坏了这些权限,请向我索要输出,我会将其包括在内。我还使用通配符分解了一些由同一用户/组拥有的大型目录。

我添加了此输出,以便您可以看到事物应该如何拥有。您可以手动chown将事物分配给大致正确的用户/组。oli是我的$USER

$ sudo find /var/ -not \( -user 0 -group 0 \) -not -path "/var/lib/schroot/*" -not -path "/var/cache/*" -not -path "/var/tmp/*" -printf "%p,%u:%g\n" | grep -viE "(squeeze|rabbitmq|nginx|lxc|postfix)" | sort -u | column -t -c 80 -s ,
/var/backups/gshadow.bak                                     root:shadow
/var/backups/shadow.bak                                      root:shadow
/var/crash/*                                                 root:whoopsie
/var/lib/avahi-autoipd/6c:f0:49:54:0b:80                     avahi-autoipd:avahi-autoipd
/var/lib/avahi-autoipd                                       avahi-autoipd:avahi-autoipd
/var/lib/colord/*                                            colord:colord
/var/lib/libuuid                                             libuuid:libuuid
/var/lib/mlocate/mlocate.db                                  root:mlocate
/var/lib/nfs/sm.bak                                          statd:nogroup
/var/lib/nfs/sm                                              statd:nogroup
/var/lib/nfs                                                 statd:nogroup
/var/lib/nfs/state                                           statd:root
/var/lib/samba/usershares/films                              oli:oli
/var/lib/samba/usershares/incoming                           oli:oli
/var/lib/samba/usershares                                    root:sambashare
/var/lib/samba/usershares/tv                                 oli:oli
/var/lib/sudo/oli/0                                          root:oli
/var/lib/sudo/oli/10                                         root:oli
/var/lib/sudo/oli/11                                         root:oli
/var/lib/sudo/oli/12                                         root:oli
/var/lib/sudo/oli/13                                         root:oli
/var/lib/sudo/oli/14                                         root:oli
/var/lib/sudo/oli/1                                          root:oli
/var/lib/sudo/oli/2                                          root:oli
/var/lib/sudo/oli/3                                          root:oli
/var/lib/sudo/oli/4                                          root:oli
/var/lib/sudo/oli/5                                          root:oli
/var/lib/sudo/oli/6                                          root:oli
/var/lib/sudo/oli/7                                          root:oli
/var/lib/sudo/oli/8                                          root:oli
/var/lib/sudo/oli/9                                          root:oli
/var/lib/sudo/oli/console                                    root:oli
/var/lib/sudo/oli                                            root:oli
/var/lib/sudo/oli/tty1                                       root:oli
/var/lib/sudo/oli/tty2                                       root:oli
/var/lib/lightdm/*                                           lightdm:lightdm
/var/local                                                   root:staff
/var/log/apport.log.1                                        root:adm
/var/log/apport.log.2.gz                                     root:adm
/var/log/apport.log.3.gz                                     root:adm
/var/log/apport.log.4.gz                                     root:adm
/var/log/apport.log.5.gz                                     root:adm
/var/log/apport.log.6.gz                                     root:adm
/var/log/apport.log.7.gz                                     root:adm
/var/log/apport.log                                          root:adm
/var/log/apt/term.log.1.gz                                   root:adm
/var/log/apt/term.log.2.gz                                   root:adm
/var/log/apt/term.log.3.gz                                   root:adm
/var/log/apt/term.log.4.gz                                   root:adm
/var/log/apt/term.log.5.gz                                   root:adm
/var/log/apt/term.log.6.gz                                   root:adm
/var/log/apt/term.log.7.gz                                   root:adm
/var/log/apt/term.log                                        root:adm
/var/log/auth.log.1                                          syslog:adm
/var/log/auth.log.2.gz                                       syslog:adm
/var/log/auth.log.3.gz                                       syslog:adm
/var/log/auth.log.4.gz                                       syslog:adm
/var/log/auth.log                                            syslog:adm
/var/log/boot                                                root:adm
/var/log/btmp.1                                              root:utmp
/var/log/btmp                                                root:utmp
/var/log/cups/access_log.1.gz                                root:adm
/var/log/cups/access_log.2.gz                                root:adm
/var/log/cups/access_log.3.gz                                root:adm
/var/log/cups/access_log.4.gz                                root:adm
/var/log/cups/access_log.5.gz                                root:adm
/var/log/cups/access_log.6.gz                                root:adm
/var/log/cups/access_log.7.gz                                root:adm
/var/log/cups/access_log                                     root:adm
/var/log/cups/error_log.1.gz                                 root:adm
/var/log/cups/error_log.2.gz                                 root:adm
/var/log/cups/error_log.3.gz                                 root:adm
/var/log/cups/error_log.4.gz                                 root:adm
/var/log/cups/error_log.5.gz                                 root:adm
/var/log/cups/error_log.6.gz                                 root:adm
/var/log/cups/error_log.7.gz                                 root:adm
/var/log/cups/error_log                                      root:adm
/var/log/cups/page_log.1.gz                                  root:adm
/var/log/cups/page_log.2.gz                                  root:adm
/var/log/cups/page_log.3.gz                                  root:adm
/var/log/cups/page_log.4.gz                                  root:adm
/var/log/cups/page_log.5.gz                                  root:adm
/var/log/cups/page_log.6.gz                                  root:adm
/var/log/cups/page_log.7.gz                                  root:lpadmin
/var/log/cups/page_log                                       root:adm
/var/log/cups                                                root:lpadmin
/var/log/dist-upgrade/20121107-0129/apt-term.log             root:adm
/var/log/dist-upgrade/20130426-1402/apt-term.log             root:adm
/var/log/dist-upgrade/apt-term.log                           root:adm
/var/log/dmesg.0                                             root:adm
/var/log/dmesg.1.gz                                          root:adm
/var/log/dmesg.2.gz                                          root:adm
/var/log/dmesg.3.gz                                          root:adm
/var/log/dmesg.4.gz                                          root:adm
/var/log/dmesg                                               root:adm
/var/log/fail2ban.log.1                                      root:adm
/var/log/fail2ban.log.2.gz                                   root:adm
/var/log/fail2ban.log.3.gz                                   root:adm
/var/log/fail2ban.log.4.gz                                   root:adm
/var/log/fail2ban.log                                        root:adm
/var/log/fsck/checkfs                                        root:adm
/var/log/fsck/checkroot                                      root:adm
/var/log/hp/hp-upgrade.log                                   oli:oli
/var/log/hp                                                  root:lp
/var/log/hp/tmp                                              root:lp
/var/log/installer/syslog                                    syslog:adm
/var/log/kern.log.1                                          syslog:adm
/var/log/kern.log.2.gz                                       syslog:adm
/var/log/kern.log.3.gz                                       syslog:adm
/var/log/kern.log.4.gz                                       syslog:adm
/var/log/kern.log                                            syslog:adm
/var/log/lastlog                                             root:utmp
/var/log/mail.err.1                                          syslog:adm
/var/log/mail.err.2.gz                                       syslog:adm
/var/log/mail.err.3.gz                                       syslog:adm
/var/log/mail.err.4.gz                                       syslog:adm
/var/log/mail.err                                            syslog:adm
/var/log/mail.log.1                                          syslog:adm
/var/log/mail.log.2.gz                                       syslog:adm
/var/log/mail.log.3.gz                                       syslog:adm
/var/log/mail.log.4.gz                                       syslog:adm
/var/log/mail.log                                            syslog:adm
/var/log/news/news.crit                                      syslog:adm
/var/log/news/news.err                                       syslog:adm
/var/log/news/news.notice                                    syslog:adm
/var/log/speech-dispatcher                                   speech-dispatcher:root
/var/log/syslog.1                                            syslog:adm
/var/log/syslog.2.gz                                         syslog:adm
/var/log/syslog.3.gz                                         syslog:adm
/var/log/syslog.4.gz                                         syslog:adm
/var/log/syslog.5.gz                                         syslog:adm
/var/log/syslog.6.gz                                         syslog:adm
/var/log/syslog.7.gz                                         syslog:adm
/var/log/syslog                                              syslog:adm
/var/log/ufw.log.1                                           syslog:adm
/var/log/ufw.log                                             syslog:adm
/var/log/wtmp.1                                              root:utmp
/var/log/wtmp                                                root:utmp
/var/mail/oli                                                oli:mail
/var/mail                                                    root:mail
/var/mail/root                                               root:mail
/var/metrics                                                 root:whoopsie
/var/spool/cron/atjobs/a000020152342b                        oli:daemon
/var/spool/cron/atjobs                                       daemon:daemon
/var/spool/cron/atjobs/.SEQ                                  daemon:daemon
/var/spool/cron/atspool                                      daemon:daemon
/var/spool/cron/crontabs/oli                                 oli:crontab
/var/spool/cron/crontabs                                     root:crontab
/var/spool/cups/c00075                                       root:lp
/var/spool/cups/c00076                                       root:lp
/var/spool/cups/c00077                                       root:lp
/var/spool/cups/c00078                                       root:lp
/var/spool/cups/d00075-001                                   root:lp
/var/spool/cups/d00076-001                                   root:lp
/var/spool/cups/d00077-001                                   root:lp
/var/spool/cups/d00078-001                                   root:lp
/var/spool/cups                                              root:lp
/var/spool/cups/tmp                                          root:lp
/var/spool/rsyslog                                           syslog:adm

相关内容