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