일반 사용자에게는 파일이 표시되지만 루트에는 존재하지 않는 파일이 어떻게 가능합니까?

일반 사용자에게는 파일이 표시되지만 루트에는 존재하지 않는 파일이 어떻게 가능합니까?

나는 어제 이 질문을 했지만 X/Y 질문으로 생각되어 중복으로 표시되어 문맥상 닫혔습니다. 개인 조사(이 웹사이트와 인터넷)에서는 아무것도 반환되지 않았으며 이러한 종류의 특이한 문제를 감지하고 처리하는 방법에 대해 자세히 알아보고 싶습니다.

root그래서 어떤 맥락도 없이 어제 우리 데비안 서버 중 하나에서 . 소유임에도 불구하고 일반 사용자에게는 표시되지만 에는 표시되지 않는 일부 파일을 발견했습니다 root.

해당 파일에 대해 많은 명령을 시도했으며 무엇을 시도하든 user파일을 일반 파일로 취급하지만 root해당 파일이 처음에 존재하지 않는 것처럼 반응합니다(그러나 그럼에도 불구하고 덮어쓸 수는 없습니다). 사람들은아니다도트 파일.

다음 명령의 결과는 다음과 같습니다.

처럼user

user@debian:/tmp$ groups
user cdrom floppy audio dip video plugdev netdev

user@debian:/tmp$ pwd
/tmp

user@debian:/tmp$ ls -lai
total 320
1048577 drwxrwxrwt 11 root       root         4096 Sep  7 13:04 .
      2 drwxr-xr-x 23 root       root         4096 Sep  6 17:34 ..
5901230 -rw-r-----  1 root       root            0 Sep  7 12:59 invisible_file
<other_files>

user@debian:/tmp$ touch invisible_file
touch: cannot touch 'invisible_file': Permission denied

user@debian:/tmp$ rm invisible_file
rm: remove write-protected regular empty file 'invisible_file'? y
rm: cannot remove 'invisible_file': Operation not permitted

user@debian:/tmp$ stat invisible_file
  File: invisible_file
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d      Inode: 5901230     Links: 1
Access: (0640/-rw-r-----)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-09-07 12:59:54.859124530 +0200
Modify: 2021-09-07 12:59:54.859124530 +0200
Change: 2021-09-07 13:04:03.063441285 +0200
 Birth: -

user@debian:/tmp$ install /dev/null invisible_file
install: cannot remove 'invisible_file': Operation not permitted

user@debian:/tmp$ cat invisible_file
cat: invisible_file: Permission denied

user@debian:/tmp$ find /tmp/ -iname "*invisible_file*"
/tmp/invisible_file

user@debian:/tmp$

처럼root

root@debian:/tmp# groups
root

root@debian:/tmp# pwd
/tmp

root@debian:/tmp# ls -lai
total 308
1048577 drwxrwxrwt 11 root       root         4096 Sep  7 13:04 .
      2 drwxr-xr-x 23 root       root         4096 Sep  6 17:34 ..
<other_files>

root@debian:/tmp# touch invisible_file

root@debian:/tmp# ls -lai
total 308
1048577 drwxrwxrwt 11 root       root         4096 Sep  7 13:04 .
      2 drwxr-xr-x 23 root       root         4096 Sep  6 17:34 ..
<other_files>

root@debian:/tmp# rm invisible_file
rm: cannot remove 'invisible_file': No such file or directory

root@debian:/tmp# stat invisible_file
stat: cannot stat 'invisible_file': No such file or directory

root@debian:/tmp# install /dev/null invisible_file
install: cannot create regular file 'invisible_file': No such file or directory

root@debian:/tmp# cat invisible_file
cat: invisible_file: No such file or directory

root@debian:/tmp# find /tmp/ -iname "*invisible_file*"

root@debian:/tmp#

명령에서도 ls사용된 총 블록 수가 다르며 크기에 따라 차이가 발생합니다 invisible_file.

파일을 덮어쓸 수 있는 유일한 방법은 다른 이름(및 다른 권한)을 사용하여 파일을 root생성 하는 것 mv입니다 .invisible_fileinvisible_fileroot

내 질문은: Linux 세계에서 루트가 내 경우처럼 처음부터 없었던 것처럼 일부 일반 파일을 완전히 무시하도록 만들 수 있습니까? 그리고 어떻게 그 문제를 조사하고, 해당 파일을 다시 표시하고, 루트에 표시되지 않는 다른 파일이 없는지 확인할 수 있습니까?

편집하다 :

출력 은 다음과 같습니다 mount. 나에게 특별한 내용은 표시되지 않습니다.

root@debian:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=4078644k,nr_inodes=1019661,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=817960k,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=9463)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=817956k,mode=700,uid=1000,gid=1000)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)

의 출력은 fsck -nf다음과 같습니다.

root@debian:~# fsck -nf
fsck from util-linux 2.29.2
e2fsck 1.43.4 (31-Jan-2017)
Warning!  /dev/sda1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 524799 has zero dtime.  Fix? no

Inodes that were part of a corrupted orphan linked list found.  Fix? no

Inode 1441794 was part of the orphaned inode list.  IGNORED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -(11108512--11108538)
Fix? no

Free blocks count wrong (16886612, counted=16857986).
Fix? no

Inode bitmap differences:  -524799 -1441794
Fix? no

Free inodes count wrong (5867140, counted=5866555).
Fix? no


/dev/sda1: ********** WARNING: Filesystem still has errors **********

/dev/sda1: 162172/6029312 files (0.3% non-contiguous), 7230636/24117248 blocks
root@Confluence:~#

fsck마침내 파일 시스템에서 전체 작업을 실행할 수 있게 되었습니다 . 위에 표시된 오류를 수정했지만 파일이 여전히 표시되지 않으므로 소용이 없습니다.

관련 정보