태그 보관물: ubuntu

ubuntu

접두사가“passwd”인 파일을 만들 수없는 이유는 무엇입니까? “/ etc”에서? 가진 파일을 경로에 passwd.만들 수 없다는 것입니다

Ubuntu 16.04가 설치된 PC가 있습니다. 최근에 일부 패키지를 설치하고 싶지만 설치하는 데 문제가 있습니다. 약간의 파기 후, 실패는 리눅스 사용자 계정 시스템과 관련이있는 것으로 나타났습니다. 문제는 접두사가 붙은 이름을 가진 파일을 경로에 passwd.만들 수 없다는 것입니다 /etc.

# ls /etc/passwd.*
ls: cannot access '/etc/passwd.*': No such file or directory

# touch /etc/passwd.test-test-test
touch: cannot touch '/etc/passwd.test-test-test': Permission denied

# ls /etc/passwe.*
ls: cannot access '/etc/passwe.*': No such file or directory

# touch /etc/passwe.test-test-test
#

나는 같은 다른 경로에서 해당 파일을 만들 수 있습니다 /또는 /usr아니라에서 /etc, 나는 다른 파일 이름으로 파일을 만들 수 있습니다 /etc접두어 파일 이름,하지만 passwd.. 다른 PC에서는이 문제를 재현 할 수 없습니다.

다른 명령을 시도했습니다.

  • nano /etc/shadow.xxx
  • echo xxx > /etc/shadow.xxx
  • touch /etc/test-temp-file && mv /etc/test-temp-file /etc/shadow.xxx
  • systemctl stop apparmor
  • 시스템을 재부팅

아무것도 작동하지 않습니다.

이 문제의 원인은 무엇입니까?

다음은 몇 가지 디버그 명령 출력입니다.

# ls -ld /etc
drwxr-xr-x 136 root root 12288 Aug 12 10:07 /etc

# lsattr -d /etc
----------I--e-- /etc

# ls -dZ /etc
? /etc

# type -a touch
touch is /usr/bin/touch
touch is /bin/touch

# file "$(command -v touch)"
/usr/bin/touch: symbolic link to /bin/touch

strace출력 은 다음과 같습니다 .

# strace touch /etc/passwd.test-test-test
execve("/usr/bin/touch", ["touch", "/etc/passwd.test-test-test"], [/* 22 vars */]) = 0
brk(NULL)                               = 0x8da000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
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=80559, ...}) = 0
mmap(NULL, 80559, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9bc360e000
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\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9bc360d000
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9bc3033000
mprotect(0x7f9bc31f3000, 2097152, PROT_NONE) = 0
mmap(0x7f9bc33f3000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f9bc33f3000
mmap(0x7f9bc33f9000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9bc33f9000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9bc360c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9bc360b000
arch_prctl(ARCH_SET_FS, 0x7f9bc360c700) = 0
mprotect(0x7f9bc33f3000, 16384, PROT_READ) = 0
mprotect(0x60e000, 4096, PROT_READ)     = 0
mprotect(0x7f9bc3622000, 4096, PROT_READ) = 0
munmap(0x7f9bc360e000, 80559)           = 0
brk(NULL)                               = 0x8da000
brk(0x8fb000)                           = 0x8fb000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1668976, ...}) = 0
mmap(NULL, 1668976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9bc3473000
close(3)                                = 0
open("/etc/passwd.test-test-test", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 EACCES (Permission denied)
utimensat(AT_FDCWD, "/etc/passwd.test-test-test", NULL, 0) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2995
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "touch: ", 7touch: )                  = 7
write(2, "cannot touch '/etc/passwd.test-t"..., 41cannot touch '/etc/passwd.test-test-test') = 41
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Permission denied", 19: Permission denied)     = 19
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++



답변

왜 그런지 알았습니다. ISecTP (Linux 용 엔드 포인트 보안 위협 예방)가 내 PC에 설치 되었기 때문입니다. 여기에는 fanotify 커널 인터페이스를 사용하거나 커널에 사용자 정의 모듈을 주입하여 (자세한 구성 가능 ) 임의의 경로에 대한 액세스를 거부 하는 ” 액세스 보호 “가 포함됩니다 . 나는 PC를 사용하는 유일한 사람이 아니기 때문에 그것을 알지 못했습니다. 제거한 후에는 모든 것이 정상입니다.

도와 주셔서 감사합니다!


답변