Eu ssh em um servidor e tentei alterar uma permissão de arquivos. Isso é o que eu consegui:
$ 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
é a abreviação de ls -l
)
Por que não está funcionando?
O resultado de 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, "7ELF$ 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
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, "7ELF%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%"..., 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 +++
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%"..., 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 +++