Compare the following:
mount -t proc none ./my_chroot/proc
and:
chroot ./mychroot mount -t proc none /proc
chrootfilesystemsSecurity
Compare the following:
mount -t proc none ./my_chroot/proc
and:
chroot ./mychroot mount -t proc none /proc
Best Answer
There are no differences with respect to the underlying kernel state.
There is a minor difference with respect to the operation of the
mount
command: it keeps track of its actions in/etc/mtab
, so runningmount
underchroot
will update a differentmtab
file.You could also use
mount --bind /proc ./my_chroot/proc
. As far as I know, there is no practical difference between that andmount -t proc none ./mychroot/proc
: you can mount theproc
filesystem as many times as you like, and mount options are ignored.mount --bind
will prevent you from unmounting the filesystem on/proc
outside the chroot, but that should never happen anyway.As an aside, I would recommend
mount -t proc proc …/proc
because seeingproc
in the device field in amtab
or in/proc/mounts
is clearer than seeingnone
.