chroot
rose1 发表于 2020-08-26 11:09浏览次数:
在类似Unix的操作系统上,chroot命令从另一个目录运行命令或交互式shell,并将该目录视为root。此过程称为更改根目录,新的根目录称为chroot jail。
有关命令的历史记录和其他信息,请参见chroot定义。
本文档介绍chroot的GNU / Linux版本。
On Unix-like operating systems, the chroot command runs a command or an interactive shell from another directory, and treats that directory as root. This process is called changing root and the new root directory is referred to as chroot jail.
For a history of the command, and other information, see our chroot definition.
This document describes the GNU/Linux version of chroot.
目录:
1 chroot 运行系统环境
2 chroot 语法
chroot 运行系统环境
chroot 语法
chroot [OPTION] NEWROOT [COMMAND [ARG]...]
chroot运行COMMAND并将根目录设置为NEWROOT。
OPTION可能是以下之一:
--userspec=USER:GROUP
|
指定要使用的用户和组。USER和GROUP可以通过名称或数字ID指定。
|
--groups=G_LIST
|
将补充组指定为g1 ,g2 ,..,gN
|
--help
|
显示帮助消息,然后退出。
|
--version
|
输出版本信息,然后退出。
|
如果未指定命令,则chroot将执行命令' $ {SHELL} -i '。默认情况下,这是' / bin / sh -i '。这会将您作为root放入NEWROOT目录中的sh shell 中。
chroot [OPTION] NEWROOT [COMMAND [ARG]...]
chroot runs COMMAND with the root directory set to NEWROOT.
OPTION may be one of the following:
--userspec=USER:GROUP
|
specify the user and group to use. USER and GROUP may be specified by name or numeric ID.
|
--groups=G_LIST
|
specify supplementary groups as g1,g2,..,gN
|
--help
|
display a help message, and exit.
|
--version
|
output version information, and exit.
|
If no command is specified, chroot executes the command '${SHELL} -i'. By default, this is '/bin/sh -i'. This will drop you into a sh shell as root in the NEWROOT directory.