linux root用户编辑文件提示没有权限

linux root用户编辑文件提示没有权限

感觉很奇怪,因为是root用户。于是查看了一下文件的权限,结果如下:

[root@localhost elasticsearch-5.3.0]# ll
total 224
-rw-r--r--.  1 501 games  11358 Mar 22  2017 LICENSE.txt
-rw-r--r--.  1 501 games 194187 Mar 22  2017 NOTICE.txt
-rw-r--r--.  1 501 games   9540 Mar 22  2017 README.textile

于是尝试去更改文件的拥有者,使用chown命令,结果还是提示没有权限,加sudo操作依然如此。

于是谷歌了一下,发现可以使用lsattr查看一下文件属性,是否有保护;有的话可以使用chattr命令来删除掉,再进行编辑。

参考: https://blog.csdn.net/evanbai/article/details/6187578

结果使用lsattr命令提示下面的错误,使用chattr依然同样的错误:

[root@localhost elasticsearch-5.3.0]# lsattr
lsattr: Inappropriate ioctl for device While reading flags on ./bin
lsattr: Inappropriate ioctl for device While reading flags on ./config
lsattr: Inappropriate ioctl for device While reading flags on ./plugins
lsattr: Inappropriate ioctl for device While reading flags on ./NOTICE.txt
lsattr: Inappropriate ioctl for device While reading flags on ./logs
lsattr: Inappropriate ioctl for device While reading flags on ./lib
lsattr: Inappropriate ioctl for device While reading flags on ./README.textile
lsattr: Inappropriate ioctl for device While reading flags on ./LICENSE.txt
lsattr: Inappropriate ioctl for device While reading flags on ./modules
lsattr: Inappropriate ioctl for device While reading flags on ./data

[root@localhost elasticsearch-5.3.0]# chattr -i *
chattr: Inappropriate ioctl for device while reading flags on bin
chattr: Inappropriate ioctl for device while reading flags on config
chattr: Inappropriate ioctl for device while reading flags on data
chattr: Inappropriate ioctl for device while reading flags on lib

继续谷歌,看到这个网页了:

https://unix.stackexchange.com/questions/90326/chattr-i-error-on-nfs

于是想到我可能是在NFS的客户端机子上操作,遂尝试去NFS服务端更改,发现果然好了……

posted @ 2022-09-08 14:44  wswang  阅读(4477)  评论(0编辑  收藏  举报