How to run a command in a chroot jail not as root and without sudo?

后端 未结 5 514
北海茫月
北海茫月 2020-12-07 22:56

I\'m setting up a minimal chroot and want to avoid having sudo or su in it but still run my processes as non-root. This is a bit of a trick as running chroot requiers root.

5条回答
  •  情话喂你
    2020-12-07 23:51

    If you invoke chroot from root, the chroot option --userspec=USER:GROUP will run the command under the non-root UID/GID.

    By the way, the option '--userspec' is first introduced in coreutils-7.5 according to a git repository git://git.sv.gnu.org/coreutils.

提交回复
热议问题