lsattr:读取标志时设备的 ioctl 不合适

rch*_*hhe 22 linux

对于我们运行 CentOS 6.0 的其中一台 Linux 服务器,如果我执行 lsattr /home,我会得到类似这样的信息(以 root 身份):

$lsattr /home
lsattr: Inappropriate ioctl for device While reading flags on /home/user
lsattr: Inappropriate ioctl for device While reading flags on /home/user
lsattr: Inappropriate ioctl for device While reading flags on /home/DIR
Run Code Online (Sandbox Code Playgroud)

现在,我尝试用 chattr 改变一些东西

$chattr -R -i /home
chattr: Inappropriate ioctl for device while reading flags on /home
Run Code Online (Sandbox Code Playgroud)

坐骑返回:

$mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda3 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
Run Code Online (Sandbox Code Playgroud)

我不知道如何解决这个问题。有人可以帮忙吗?

cku*_*jau 12

所在的文件系统/home必须支持Extended Attributes。由于/home最有可能位于您的LogVol00分区上(而不是 NFS 挂载或其他东西),您必须使用user_xattr挂载选项挂载文件系统:

mount -o 重新挂载,user_xattr /

请注意,ext4这两个user_xattracl默认启用。这对于其他文件系统会有所不同。


use*_*749 8

我意识到这是一个旧线程,但看起来 /home 下的目录很可能是自动挂载的 nfs 导出,而 nfs 不支持 chattr、lsattr 等。您必须在 nfs 服务器的文件系统上设置它(如果可能)以使文件不可变。


mdp*_*dpc -1

我假设 /home 位于您的根卷下。您要做的就是更改根卷的 /etc/fstab 文件以添加“acl”选项。这会激活文件系统上的 ACL。

然后,要激活 ACL,请重新安装根卷 (mount -o remount,acl /) 或重新引导系统(因为 acl 选项现在位于根卷的选项字段中)。