我通过 ssh 连接到服务器,并尝试更改文件权限。这就是我得到的:
$ ll
total 1
-rwx--x--x 1 <user> <groups> 17 Jul 29 12:06 index.html
$ chmod 777 index.html
$ echo $?
0
$ ll
total 1
-rwx--x--x 1 <user> <groups> 17 Jul 29 12:06 index.html
(ll
的缩写ls -l
)
为什么它不起作用?
的结果strace chmod 777 index.html
是:
execve("/bin/chmod", ["chmod", "777", "index.html"], [/* 33 vars */]) = 0
brk(0) = 0xc3a000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0cf7687000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=83490, ...}) = 0
mmap(NULL, 83490, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0cf7672000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0cf70a2000
mprotect(0x7f0cf725d000, 2093056, PROT_NONE) = 0
mmap(0x7f0cf745c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f0cf745c000
mmap(0x7f0cf7462000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f0cf7462000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0cf7671000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0cf766f000
arch_prctl(ARCH_SET_FS, 0x7f0cf766f740) = 0
mprotect(0x7f0cf745c000, 16384, PROT_READ) = 0
mprotect(0x60c000, 4096, PROT_READ) = 0
mprotect(0x7f0cf7689000, 4096, PROT_READ) = 0
munmap(0x7f0cf7672000, 83490) = 0
brk(0) = 0xc3a000
brk(0xc5b000) = 0xc5b000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0cf6dd9000
close(3) = 0
umask(0) = 022
stat("index.html", {st_mode=S_IFREG|0711, st_size=17, ...}) = 0
fchmodat(AT_FDCWD, "index.html", 0777) = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
答案1
您会发现该分区是从某种不实现 POSIX 权限的 NAS 设备安装的,或者已配置为忽略权限更改。
通过查看输出可以发现它不是本地文件系统df -h index.html