man dchroot (Commandes) - enter a chroot environment

NAME

dchroot - enter a chroot environment

SYNOPSIS

dchroot [OPTION]... [COMMAND]

DESCRIPTION

dchroot allows the user to run a command or a login shell in a chroot environment. If no command is specified, a login shell will be started in the user's current working directory inside the chroot.

This version of dchroot is a compatibility wrapper around the schroot(1) program. It is provided for backward compatibility with the dchroot command-line options, but schroot is recommended for future use. See the section [lq]Migration[rq] below for help migrating your existing dchroot configuration to schroot. See the section [lq]Incompatibilities[rq] below for known incompatibilities with dchroot.

If no chroot is specified, the chroot name or alias default will be used as a fallback. If using the configuration in /etc/dchroot.conf, the first chroot in the file is the default.

OPTIONS

Note that the original dchroot did not provide long options. dchroot accepts the following options:

Basic options

-h, --help
Show help summary.
-a, --all
Select all chroots.
-l, --list
List all available chroots.
-i, --info
Print detailed information about the specified chroots. Note that the original dchroot did not include this option.
-p, --path
Print location (path) of the specified chroots.
--config
Print configuration of the specified chroots. This is useful for testing that the configuration in use is the same as the configuration file. Any comments in the original file will be missing. Note that the original dchroot did not include this option.
-d, --preserve-environment
Preserve the user's environment inside the chroot environment. The default is to use a clean environment; this option copies the entire user environment and sets it in the session.
-q, --quiet
Print only essential messages.
-v, --verbose
Print all messages. Note that the original dchroot did not include this option.
-V, --version
Print version information.

CONFIGURATION

The original dchroot configuration file, /etc/dchroot.conf has the following format:

[bu]
[oq]#[cq] starts a comment line.
[bu]
Blank lines are ignored.
[bu]
Chroot definitions are a single line containing an identifier and a path, separated by whitespace. The first chroot is also the default.

An example file:

CR]# Example comment

CR]

CR]sarge /srv/chroot/sarge

CR]sid /srv/chroot/sid

This file defines a chroot called [oq]sarge[cq], located at /srv/chroot/sarge, and a second chroot called [oq]sid[cq], located at /srv/chroot/sid.

INCOMPATIBILITIES

[bu]
Log messages are worded and formatted differently.
[bu]
The parsing of /etc/dchroot.conf uses a smaller list of allowed whitespace characters (space and tab), which may cause a parse error during tokenising if the file contains odd characters as separators, such as carriage returns, vertical tabs and form feeds.
[bu]
dchroot provides a restricted subset of the functionality implemented by schroot, but is still schroot underneath. Thus dchroot is still subject to schroot security checking, including PAM authentication and authorisation, and session management, for example, and hence may behave slightly differently to the original dchroot in some circumstances.

MIGRATION

To migrate an existing dchroot configuration to schroot, perform the following steps:

1
Dump the dchroot configuration in schroot keyfile format to /etc/schroot/schroot.conf.

CR]# CB]dchroot --config >> /etc/schroot/schroot.conf

2
Edit /etc/schroot/schroot.conf to add access to the groups who are to be allowed to access the chroots, and make any other desired changes to the configuration. See schroot.conf(5).
3
Remove /etc/dchroot.conf, so that dchroot will subsequently use /etc/schroot/schroot.conf for its configuration. If the dchroot package is still installed, purge it, or else delete the file.

EXAMPLES

CR]$ schroot/dchroot -l

CR]Available chroots: sarge [default], sid

CR]

CR]$ schroot/dchroot -p sid

CR]/srv/chroot/sid

CR]

CR]$ dchroot -q -c sid -- uname -smr

CR]Linux 2.6.15.4 ppc

CR]

CR]$ dchroot -c sid

CR]I: [sid chroot] Running login shell: [lq]/bin/bash[rq]

CR]$

Use -- to allow options beginning with [oq]-[cq] or [oq]--[cq] in the command to run in the chroot. This prevents them being interpreted as options for schroot itself. Note that the top line was echoed to standard error, and the remaining lines to standard output. This is intentional, so that program output from commands run in the chroot may be piped and redirected as required; the data will be the same as if the command was run directly on the host system.

BUGS

None known at this time.

FILES

/etc/dchroot.conf
The system-wide dchroot chroot definition file. This file must be owned by the root user, and not be writable by other. If present, this file will be used in preference to /etc/schroot/schroot.conf.
/etc/schroot/schroot.conf
The system-wide schroot definition file. This file must be owned by the root user, and not be writable by other. It is recommended that this file be used in preference to /etc/dchroot.conf, because the chroots can be used interchangeably with schroot, and the group security policies provided by schroot are also enforced.

AUTHORS

Roger Leigh.

This implementation of dchroot uses the same command-line options as the original dchroot by David Kimdon <dwhedon@debian.org>, but is an independent implementation.

COPYRIGHT

Copyright © 2005-2006 Roger Leigh <rleigh@debian.org>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

SEE ALSO