如何修复根文件夹中的权限警告?

如何修复根文件夹中的权限警告?

昨天,我注意到安装 Samba 时终端窗口显示一条警告。警告内容如下:

WARN: /etc/default/ufw is group writable!
WARN: /etc/default is group writable!
WARN: /etc is group writable!
WARN: / is group writable!
WARN: /lib/ufw/user.rules is group writable!
WARN: /lib/ufw is group writable!
WARN: /lib is group writable!
WARN: /etc/ufw/applications.d is group writable!
WARN: /etc/ufw is group writable!
WARN: /etc/ufw/after6.rules is group writable!
WARN: /lib/ufw/ufw-init is group writable!
WARN: /etc/ufw/ufw.conf is group writable!
WARN: /lib/ufw/user6.rules is group writable!
WARN: /etc/ufw/before6.rules is group writable!
WARN: /etc/ufw/after.rules is group writable!
WARN: /etc/ufw/before.rules is group writable!
WARN: /usr/sbin/ufw is group writable!
WARN: /usr/sbin is group writable!
WARN: /usr is group writable!

我不知道这个问题已经存在多久了(虽然我认为最多不超过几周),因为我不经常使用终端。我也不知道是什么导致了权限的转变。

ls -l / 输出:

total 96
drwxrwxr-x   2 root root  4096 Feb 28 20:00 bin
drwxrwxr-x   4 root root  4096 Feb 19 21:44 boot
drwxrwxr-x   2 root root  4096 Jun 22  2013 cdrom
drwxr-xr-x  14 root root  4440 Mar  1 11:11 dev
drwxrwxr-x 158 root root 12288 Mar  1 11:12 etc
drwxrwxr-x   3 root root  4096 Mar  1 00:42 home
lrwxrwxrwx   1 root root    33 Feb 19 21:43 initrd.img -> /boot/initrd.img-3.5.0-46-generic
lrwxrwxrwx   1 root root    33 Jan  3 10:55 initrd.img.old -> /boot/initrd.img-3.5.0-45-generic
drwxrwxr-x  27 root root  4096 Feb  8 12:01 lib
drwxr-xr-x   2 root root  4096 Feb  8 11:58 lib32
drwxrwxr-x   2 root root  4096 Oct 22 09:08 lib64
drwxrwxr-x   2 root root 16384 Jun 22  2013 lost+found
drwxrwxr-x  14 root root  4096 Mar  1 11:12 media
drwxrwxr-x   2 root root  4096 Apr 19  2012 mnt
drwxrwxr-x   4 root root  4096 Sep  9 07:29 opt
dr-xr-xr-x 209 root root     0 Mar  1  2014 proc
drwxrwxr-x  16 root root  4096 Feb  8 11:55 root
drwxr-xr-x  22 root root   780 Mar  1 11:12 run
drwxrwxr-x   2 root root  4096 Mar  1 00:18 sbin
drwxrwxr-x   2 root root  4096 Mar  5  2012 selinux
drwxrwxr-x   3 root root  4096 Feb 28 19:24 srv
dr-xr-xr-x  13 root root     0 Mar  1  2014 sys
drwxrwxrwt  17 root root  4096 Mar  1 11:15 tmp
drwxrwxr-x  11 root root  4096 Feb 20 21:20 usr
drwxrwxr-x  13 root root  4096 Mar  1 01:02 var
lrwxrwxrwx   1 root root    29 Feb 19 21:43 vmlinuz -> boot/vmlinuz-3.5.0-46-generic
lrwxrwxrwx   1 root root    29 Jan  3 10:55 vmlinuz.old -> boot/vmlinuz-3.5.0-45-generic

我的问题是,这些文件夹中权限的正常值是多少?如果我通过命令删除组写入权限,是否可以解决问题chmod?还有什么我应该注意的吗?

谢谢!

答案1

是的,如果您通过删除组写权限,问题就可以解决chmod

sudo chmod 751 <files or directories>

答案2

我也遇到了同样的问题。试试这个

sudo -i
chmod 755 /etc /lib /usr

有同样问题的人只需替换目录即可/ETC或者/lib错误目录。假设受影响的目录是 /svr,则执行chmod 755 /svr

更多详细信息755 权限

祝你好运

相关内容