.\" 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. .\" .\" @(#) setuid. 2 8.1 (Berkeley) 6/4/93 .\" %FreeBSD: src/lib/libc/sys/setuid. 2, v 1.13. 2.6 2001/12/14 18:34:01 ru Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man2/setuid. 2, v 1.8 2001/12/23 00:03:42 horikawa Exp $ .Dd June 4, 1993 .Dt SETUID 2 .Os .Sh ¸íĪ .Nm setuid , .Nm seteuid , .Nm setgid , .Nm setegid , .Nd À¯Àú ID ¿Í ±×·ì ID ¸¦ ¼³Á¤ÇÑ´Ù .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In sys/types.h .In unistd.h .Ft int .Fn setuid "uid_t uid" .Ft int .Fn seteuid "uid_t euid" .Ft int .Fn setgid "gid_t gid" .Ft int .Fn setegid "gid_t egid" .Sh ÇØ¼³ .Fn setuid ÇÔ¼ö´Â, ÇöÀçÀÇ ÇÁ·Î¼¼½ºÀÇ ¿­¸Å À¯Àú ID ¿Í ½ÇÈ¿ À¯Àú ID ¿Í ÅðÇÇ ±×·ì ID ¸¦ ÁöÁ¤ÇÑ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. .\" Comment out next block for ! _POSIX_SAVED_IDS .\" The real user ID and the saved set-user-ID are changed only if the .\" effective user ID is that of the super user. .\" I.e. .\" .Fn setuid .\" function is equal to .\" .Fn seteuid .\" function if the effective user ID is not that of the super user. .\" End of block .Fn setuid ÇÔ¼ö°¡ Çã¿ë µÇ´Â °ÍÀº, ÁöÁ¤ÀÇ ID °¡ ÇÁ·Î¼¼½ºÀÇ ¿­¸Å À¯Àú ID ¶Ç´Â ½ÇÈ¿ À¯Àú ID ¿¡ µ¿ÀÏÇÑ °æ¿ì, ¶Ç´Â ½ÇÈ¿ À¯Àú ID °¡ ½´ÆÛ À¯ÀúÀÇ °Í°ú µ¿ÀÏÇÑ °æ¿ìÀÔ´Ï´Ù. .\" Comment out next line for ! _POSIX_SAVED_IDS .\" or the saved set-user-ID .\" Next line is for Appendix B. 4.2. 2 case. .Pp .Fn setgid ÇÔ¼ö´Â, ÇöÀçÀÇ ÇÁ·Î¼¼½ºÀÇ ¿­¸Å ±×·ì ID ¿Í ½ÇÈ¿ ±×·ì ID ¿Í ÅðÇÇ ±×·ì ID ¸¦ ÁöÁ¤ÇÑ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. .\" Comment out next block for ! _POSIX_SAVED_IDS .\" The real group ID and the saved set-group-ID are changed only if the .\" effective user ID is that of the super user. .\" I.e. .\" .Fn setgid .\" function is equal to .\" .Fn setegid .\" function if the effective user ID is not that of the super user. .\" End of block .Fn setgid ÇÔ¼ö°¡ Çã¿ë µÇ´Â °ÍÀº, ÁöÁ¤ÀÇ ID °¡ ÇÁ·Î¼¼½ºÀÇ ¿­¸Å ±×·ì ID ¶Ç´Â ½ÇÈ¿ ±×·ì ID ¿¡ µ¿ÀÏÇÑ °æ¿ì, ¶Ç´Â ½ÇÈ¿ À¯Àú ID °¡ ½´ÆÛ À¯ÀúÀÇ °Í°ú µ¿ÀÏÇÑ °æ¿ìÀÔ´Ï´Ù. .\" Comment out next line for ! _POSIX_SAVED_IDS .\" or the saved set-group-ID .\" Next line is for Appendix B. 4.2. 2 case. .Pp .Fn seteuid ÇÔ¼ö .Pq Fn setegid (Àº)´Â, ÇöÀçÀÇ ÇÁ·Î¼¼½ºÀÇ ½ÇÈ¿ À¯Àú (±×·ì ID)¸¦ ¼³Á¤ÇÕ´Ï´Ù. ½ÇÈ¿ À¯Àú ID ´Â ¿­¸Å À¯Àú ID ¶Ç´Â ÅðÇÇ À¯Àú ID ( .Xr intro 2 (¿Í)°ú .Xr execve 2 (À»)¸¦ ÂüÁ¶ )ÀÇ °ªÀ¸·Î ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. À̰ÍÀ» ÀÌ¿ëÇØ, set-user-ID ½ÇÇà °¡´É ÆÄÀÏÀÇ ½ÇÈ¿ À¯Àú ID ¸¦ ¿­¸Å À¯Àú ID ·Î ÀüȯÇÑ ÈÄ¿¡, set-user-ID Ä¡·Î µ¹¾Æ¿À´Â °ÍÀ¸·Î, ¿øÀÇ ±ÇÇÑÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù. ¶È°°ÀÌ, ½ÇÈ¿ ±×·ì ID ´Â, ¿­¸Å ±×·ì ID ¶Ç´Â ÅðÇÇ À¯Àú ID ÀÇ °ªÀ¸·Î ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. .Sh ¹Ýȯ°ª .Rv -std .Sh ¿¡·¯ º»ÇÔ¼ö´Â ´ÙÀ½ÀÇ °æ¿ì¿¡ ½ÇÆÐÇÕ´Ï´Ù: .Bl -tag -width Er .It Bq Er EPERM À¯Àú°¡ ½´ÆÛ À¯Àú°¡ ¾Æ´Ñ °æ¿ì, ¶Ç´Â ÁöÁ¤µÈ uid °¡ ±× ¿­¸Å ID, ½ÇÈ¿ ID, ¶Ç´Â ÅðÇÇ ID °¡ ¾Æ´Ñ °æ¿ì. .El .Sh °ü·Ã Ç׸ñ .Xr getgid 2 , .Xr getuid 2 , .Xr issetugid 2 , .Xr setregid 2 , .Xr setreuid 2 .Sh Ç¥ÁØ .Fn setuid ÇÔ¼ö¿Í .Fn setgid ÇÔ¼ö´Â .St -p1003.1-90 »ç¾ç°ú ȣȯ¼ºÀÌ ÀÖ½À´Ï´Ù. ´Ù¸¸, .Li _POSIX_SAVED_IDS .\" Uncomment next line for ! _POSIX_SAVED_IDS (Àº)´Â ºÎ·Ï B. 4.2. 2 ÀÇ Çã°¡µÈ È®ÀåÀ¸·Î Á¤Àǵǰí ÀÖÁö ¾Ê½À´Ï´Ù. .Fn seteuid ÇÔ¼ö¿Í .Fn setegid ÇÔ¼ö´Â, .Li _POSIX_SAVED_IDS ÀÇ .Tn POSIX ÄÁ¼ÁÀ» ±âÃÊ·Î ÇØ È®ÀåµÇ¾î ÀÖ¾î, Ç¥ÁØÀÇ Àå·¡ÀÇ °³Á¤¿ëÀ¸·Î Á¦¾ÈµÇ¾î ÀÖ½À´Ï´Ù. .Sh ¿ª»ç .Fn setuid ÇÔ¼ö È£Ãâ°ú .Fn setgid ÇÔ¼ö È£ÃâÀº .At v7 ±×¸®°í µîÀåÇß½À´Ï´Ù.