133 lines
4.5 KiB
Groff
133 lines
4.5 KiB
Groff
.\" Copyright (c) 1983, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)chroot.2 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/sys/chroot.2,v 1.20 2004/07/02 23:52:13 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt CHROOT 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm chroot
|
|
.Nd ¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê¤òÊѹ¹¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In unistd.h
|
|
.Ft int
|
|
.Fn chroot "const char *dirname"
|
|
.Sh ²òÀâ
|
|
.Fa dirname
|
|
°ú¿ô¤Ï¡¢ASCII ¤Î¥Ì¥ëʸ»ú¤Ç½ªÎ»¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Ñ¥¹Ì¾¤Î¥¢¥É¥ì¥¹¤Ç¤¹¡£
|
|
.Fn chroot
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢
|
|
.Fa dirname
|
|
¤ò¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê¡¢¤¹¤Ê¤ï¤Á¡¢
|
|
.Ql /
|
|
¤Ç³«»Ï¤¹¤ë¥Ñ¥¹Ì¾¤Î¥Ñ¥¹¸¡º÷¤Î
|
|
³«»ÏÅÀ¤Ë¤·¤Þ¤¹¡£
|
|
.Pp
|
|
¥Ç¥£¥ì¥¯¥È¥ê¤¬¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ê¤ë¤¿¤á¤Ë¤Ï¡¢
|
|
¥×¥í¥»¥¹¤Ë¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î¼Â¹Ô (¸¡º÷) µö²Ä¤¬¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
|
|
.Pp
|
|
.Fn chroot
|
|
¤Ï¥×¥í¥»¥¹¤Î¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë±Æ¶Á¤·¤Ê¤¤¤³¤È¤ËÃí°Õ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤»¤ë¤Î¤Ï¥¹¡¼¥Ñ¥æ¡¼¥¶¤Î¤ß¤Ç¤¹¡£
|
|
.Pp
|
|
¥Ç¥£¥ì¥¯¥È¥ê¤ò»²¾È¤¹¤ë¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò»Ò¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢
|
|
.Fn chroot
|
|
¸Æ¤Ó½Ð¤·¤Ï sysctl ÊÑ¿ô
|
|
.Ql kern.chroot_allow_open_directories
|
|
¤ÎÀßÄê¤Ë½¾¤¤¡¢¼¡¤Î¤è¤¦¤Ë¼ºÇÔ¤·¤Þ¤¹:
|
|
.Pp
|
|
.Ql kern.chroot_allow_open_directories
|
|
¤¬ 0 ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥Ç¥£¥ì¥¯¥È¥ê¤¬¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ì¤Ð
|
|
.Fn chroot
|
|
¤Ï¾ï¤Ë
|
|
.Er EPERM
|
|
¤Ç¼ºÇÔ¤·¤Þ¤¹¡£
|
|
.Pp
|
|
.Ql kern.chroot_allow_open_directories
|
|
¤¬ 1 ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç (¥Ç¥Õ¥©¥ë¥È)¡¢
|
|
¥Ç¥£¥ì¥¯¥È¥ê¤¬¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Æ¡¢¤½¤Î¥×¥í¥»¥¹¤¬
|
|
.Fn chroot
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î±Æ¶Á¤ò¼õ¤±¤ë»þ¡¢
|
|
.Fn chroot
|
|
¤Ï
|
|
.Er EPERM
|
|
¤Ç¼ºÇÔ¤·¤Þ¤¹¡£
|
|
.Pp
|
|
.Ql kern.chroot_allow_open_directories
|
|
¤¬Â¾¤ÎÃͤξì¹ç¡¢¥ª¡¼¥×¥ó¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Á¥§¥Ã¥¯¤Ï¤µ¤ì¤Þ¤»¤ó¡£
|
|
.Pp
|
|
Àµ¾ï¤Ë´°Î»¤¹¤ë¤È¡¢ÃÍ 0 ¤¬ÊÖ¤µ¤ì¤Þ¤¹¡£
|
|
¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢ÃÍ -1 ¤¬ÊÖ¤µ¤ì¡¢¥¨¥é¡¼¤ò¼¨¤¹¤¿¤á¤Ë
|
|
.Va errno
|
|
¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
|
|
.Sh ¥¨¥é¡¼
|
|
.Fn chroot
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¼¡¤Î¾ì¹ç½èÍý¤Ë¼ºÇÔ¤·¡¢¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê¤ÏÊѹ¹¤µ¤ì¤Þ¤»¤ó:
|
|
.Bl -tag -width Er
|
|
.It Bq Er ENOTDIR
|
|
¥Ñ¥¹¤Î¹½À®Í×ÁÇÃæ¤Ë¥Ç¥£¥ì¥¯¥È¥ê°Ê³°¤Î¤â¤Î¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EPERM
|
|
¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥¹¡¼¥Ñ¥æ¡¼¥¶¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤¬ 1 ¤Ä°Ê¾å¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ë¤è¤Ã¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENAMETOOLONG
|
|
¥Ñ¥¹Ì¾¤Î¹½À®Í×ÁǤ¬ 255 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤ë¤«¡¢
|
|
¤Þ¤¿¤Ï¥Ñ¥¹Ì¾Á´ÂΤ¬ 1023 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENOENT
|
|
»ØÄê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Þ¤»¤ó¡£
|
|
.It Bq Er EACCES
|
|
»ØÄꤵ¤ì¤¿¥Ñ¥¹¤Ë¤Ï¡¢¸¡º÷¤¬µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ELOOP
|
|
¥Ñ¥¹Ì¾¤òÊÑ´¹¤¹¤ë¤È¤¤Ë¸¡½Ð¤µ¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬Â¿¤¹¤®¤Þ¤¹¡£
|
|
.It Bq Er EFAULT
|
|
.Fa dirname
|
|
°ú¿ô¤¬¡¢¥×¥í¥»¥¹¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥¢¥É¥ì¥¹¶õ´Ö¤ÎÈϰϳ°¤ò»Ø¤·¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EIO
|
|
¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ËÆÉ¤ß½ñ¤¤·¤Æ¤¤¤ë´Ö¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr chdir 2 ,
|
|
.Xr jail 2
|
|
.Sh Îò»Ë
|
|
.Fn chroot
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
|
|
.Bx 4.2
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|
|
.Sh ¥Ð¥°
|
|
¥×¥í¥»¥¹¤¬¤½¤Îºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤òÌÜŪ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ËÊѹ¹²Äǽ¤Ç¤¢¤ë¤¬¡¢
|
|
(¥Ç¥£¥ì¥¯¥È¥ê¤Î¥ª¡¼¥×¥ó¥Á¥§¥Ã¥¯¡¢¤Þ¤¿¤Ï MAC ¥Á¥§¥Ã¥¯¤Î¤è¤¦¤Ê) ¾¤Î
|
|
¥¢¥¯¥»¥¹À©¸æ¥Á¥§¥Ã¥¯¤Ç¼ºÇÔ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤Îºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤¬
|
|
Êѹ¹¤µ¤ì¤¿¤Þ¤Þ¡¢¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬¥¨¥é¡¼¤òÊÖ¤¹¤«¤â¤·¤ì¤Þ¤»¤ó¡£
|