0

I set chroot for my project folder ~/workspace/apollo.0 to create a security JAIL.

After running chroot command, fake root filesystem is created in my project folder to make it as security JAIL.

To analyse each sub-folder in my project folder,

Case 1: By exiting from chroot ran below commands,

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>

As I exit from chroot, /proc is proc in actual root file system. proc/ is proc in my project folder(fake root file system ~/workspace/apollo.0). ls /proc is understood.

Case 2: By not exiting from chroot, ran below commands,

    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>

Being in chroot, don't be confused by prompt showing my folder path rather than %, because this part is customized.


Being in chroot, below is the info

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>

Taking second case, I could not understand two points,

1) /proc and proc/ both are ~/workspace/apollo.0 but /proc is shown as mount point unlike proc/.

2) ls /proc shows the process details, but ls proc does not show the process details.

How do I understand this?

  • Your question is not very clear. Clearly /proc is /proc while proc/ is /home/overexchange/workspace/apollo.0/proc. Why do you expect them to be the same? – lgeorget Apr 8 '17 at 16:32
  • Because proc dose not start with a / it is a relative path. That is relative to the current working directory. – ctrl-alt-delor Apr 8 '17 at 16:43
  • @richard Yes, If I exit from chroot then, /proc is proc in actual root file system. proc/ is proc in my project folder(fake root file system). If I do not exit from chroot then my understanding is both /proc and proc/ are ~/workspace/appollo.0/proc, my project folder. – overexchange Apr 8 '17 at 16:54
  • 2
    Only the processes inside the chroot (so the process that did the chroot and the processes it forks) see it. The other processes are not affected. If you're able to see the ~/workspace/apollo.0 folder, you're outside the chroot. – lgeorget Apr 8 '17 at 17:00
  • How did you start the chroot? Did you or your script mount /proc (possibly using mount -t proc proc proc/)? What do mount and cat /proc/mounts show? – Mikel Apr 8 '17 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.