Script to transform CVS sources into buildable source tree.
[shells] / chrootsh.8
CommitLineData
ed36b0a2 1.TH chrootsh 8 "20 April 1999" "Local tools"
2.SH NAME
3chrootsh \- logs a user into a safe chrooted environment
4.SH SYNOPSIS
5.B chrootsh
6.SH USAGE
7Set a user's shell to the
8.B chrootsh
9program's path.
10.PP
11When run,
12.B chrootsh
13ensures that the current user has his or her shell set to be
14.BR chrootsh .
15If not, an error is raised and the program exits.
16.PP
17Assuming things check out OK, the user's home directory is examined. It
18should be of the form
19.IB gaoldir /./ homedir
20where
21.I gaoldir
22is the path to the chroot gaol in which the user is to be imprisoned,
23and
24.I homedir
25is the path from the root of the gaol to the user's actual home
26directory. (This is for the benefit of users outside the gaol;
27.B chrootsh
28uses information from the gaol's
29.B /etc/passwd
30file to work this out. You'd do yourself a favour to make sure the two
31are consistent.)
32.PP
33Once the new root directory is set,
34.B chrootsh
35drops all of its privileges, and re-reads the user's information
36(presumably from a local version of the
37.B /etc/passwd
38file) to find the appropriate shell and home directory. It sets
39appropriate values in the environment, and invokes the user's shell.
40.SH EXAMPLE
41Suppose
42.B /home/gaol
43is a carefully set-up environment for users to run in, with a minimal
44set of tools installed. To set up a user
45.B fred
46within the gaol, make a directory
47.B /home/gaol/home/fred
48for the user, setting the access permissions as required. Then add a
49line like
50.PP
51.RS 5
52.nf
53.ft B
54fred:*:1042:1042:Fred:/home/gaol/./home/fred:/usr/bin/chrootsh
55.ft R
56.fi
57.RE
58.PP
59to the main password database (wherever that is). Then, put a line
60.PP
61.RS 5
62.nf
63.ft B
64fred:*:1042:1042:Fred:/home/fred:/bin/sh
65.ft R
66.fi
67.RE
68.PP
69in the gaol's password file
70.BR /home/gaol/etc/passwd .
71Finally, set a sensible password for
72.B fred
73in the main password database, and everything ought to work.
cf60a621 74.PP
75The
76.B chrootsh
77program makes entries in the system log whenever a user logs in, or when
78something goes wrong. Every call ought to make at least one log entry.
79Logging is done to the
80.B LOG_DAEMON
81facility, because the idea is that users with shells like this get used
82to run `daemon'-like services.
ed36b0a2 83.SH BUGS
84The
85.B chrootsh
86program must be installed
87.RB setuid- root .
88While the author has made a fair effort to avoid security holes, he
89might have missed something. There's no substitute for thorough
90auditing. If you find a security problem, please report it to the
91author as a serious bug.
92.SH SEE ALSO
93.BR banned (8),
94.BR ushell (1).
95.SH AUTHOR
96Mark Wooding (mdw@nsict.org)