Eu defino chroot
para minha pasta do projeto ~/workspace/apollo.0
para criar uma segurança JAIL.
Depois de executar o comando chroot
, o sistema de arquivos raiz falso é criado na pasta do meu projeto para torná-lo como segurança JAIL.
Para analisar cada subpasta na pasta do meu projeto,
Caso 1: Ao sair de chroot
, executou os comandos abaixo
overexchange@ab111@~/workspace/apollo.0>mountpoint /proc; printf "$?\n"
/proc is a mountpoint
0
overexchange@ab111@~/workspace/apollo.0>mountpoint proc/; printf "$?\n"
proc/ is not a mountpoint
1
overexchange@ab111@~/workspace/apollo.0>
Ao sair de chroot
, /proc
é proc
no sistema de arquivos raiz real. proc/
é proc
na pasta do meu projeto (sistema de arquivos raiz falso ~/workspace/apollo.0
). ls /proc
é entendido.
Caso 2: Por não sair do chroot
, correu abaixo dos comandos,
overexchange@ab111@~/workspace/apollo.0>mountpoint /proc; printf "$?\n"
/proc is a mountpoint
0
overexchange@ab111@~/workspace/apollo.0>mountpoint proc/; printf "$?\n"
proc/ is not a mountpoint
1
overexchange@ab111@~/workspace/apollo.0>
Estando em chroot
, não se confunda com o prompt mostrando meu caminho de pasta, em vez de %
, porque essa parte é personalizada.
Estando em chroot
, abaixo está a informação
overexchange@ab111@~/workspace/apollo.0>mount
/dev/md125 on / type ext4 (rw,relatime,data=writeback)
none on /dev type tmpfs (rw,relatime)
tmpfs on /var/run/netns type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
/dev/md125 on /home/abcdef type ext4 (rw,relatime,data=writeback)
/dev/md125 on /home/overexchange type ext4 (rw,relatime,data=writeback)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
/dev/md125 on /tmp/.X11-unix type ext4 (rw,relatime,data=writeback)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
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/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
overexchange@ab111@~/workspace/apollo.0>cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/md125 / ext4 rw,relatime,data=writeback 0 0
none /dev tmpfs rw,relatime 0 0
tmpfs /var/run/netns tmpfs rw,relatime 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/md125 /home/abcdef ext4 rw,relatime,data=writeback 0 0
/dev/md125 /home/overexchange ext4 rw,relatime,data=writeback 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
/dev/md125 /tmp/.X11-unix ext4 rw,relatime,data=writeback 0 0
tmpfs /sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
overexchange@ab111@~/workspace/apollo.0>
Tomando o segundo caso, não consegui entender dois pontos,
1) /proc
e proc/
ambos são ~/workspace/apollo.0
, mas /proc
é mostrado como ponto de montagem, ao contrário de proc/
.
2) ls /proc
mostra os detalhes do processo, mas ls proc
não mostra os detalhes do processo.
Como eu entendo isso?
Tags ls chroot proc linux root-filesystem