ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxºÍUnix¶¯Ì¬Á´½Ó¿âµÄ°²È«

·¢²¼Ê±¼ä:2012-03-06 15:58:29À´Ô´:ºìÁª×÷Õß:haoyu592
ʵ¼ÊÉÏËùÓгÌÐòÖ´Ðж¼ÒÀÀµÓÚ¿â¡£ÔÚ°üÀ¨LinuxµÄ´ó¶àÊýÏÖ´úÀàUnixϵͳÖУ¬³ÌÐòȱʡʹÓö¯Ì¬Á¬½Ó¿â£¨DLL£©½øÐбàÒë¡£ÕâÑù¾Í¿ÉÒÔ¸üÐÂij¸ö¿â£¬ËùÓÐʹÓøÿâµÄ³ÌÐòÈç¹û¿ÉÄܵĻ°£¬¶¼½«Ê¹ÓÃеģ¨Ï£ÍûÓÐËù¸Ä½øµÄ£©°æ±¾¡£
¶¯Ì¬Á¬½Ó¿âͨ³£±»·ÅÔÚÈô¸ÉÌØÊâĿ¼Ï¡£Í¨³£ÕâЩĿ¼°üÀ¨/lib¡¢/usr/lib¡¢ÓйØPAMÄ£¿éµÄ/lib/security¡¢ÓйØX-windowsµÄ/usr/X11R6/libºÍ/usr/local/lib.
¶ÔÓÚ¿âµÄÃüÃûºÍ½øÐпâµÄ·ûºÅÁ¬½ÓÓÐЩÌØÊâÔ¼¶¨£¬ÕâÑù¾Í¿ÉÒÔ¸üп⣬ͬʱ¼ÌÐøÖ§³ÖÐèҪʹÓò»¾ßÓз´Ïò¼æÈݵÄÀÏ°æ±¾¿âµÄ³ÌÐò¡£ÔÚÖ´ÐÐÌض¨³ÌÐòʱ¿ÉÒÔ¸²¸Çij¸öÖ¸¶¨¿â£¬ÉõÖÁÖ»¸²¸Çij¸ö¿âÀïµÄÖ¸¶¨º¯Êý¡£ÕâÊÇÀàUnixϵͳÏà¶ÔÓÚÀàWindowsϵͳµÄÒ»¸öʵ¼ÊÓŵ㣻ÎÒÏàÐÅÀàUnixϵͳÓÐÒ»¸ö¸üºÃµÄϵͳÀ´´¦Àí¿âµÄ¸üУ¬ÕâÒ²ÊÇUnixºÍLinuxϵͳ±»ÈÏΪ±È»ùÓÚWindowsµÄϵͳ¸üÎȶ¨µÄÔ­Òò¡£
ÔÚ°üÀ¨ËùÓÐLinuxϵͳµÄ»ùÓÚGNU glibcµÄϵͳÖУ¬³ÌÐòÆô¶¯Ê±×Ô¶¯Ñ°ÕÒµÄĿ¼Áбí´æ´¢ÔÚÎļþ/etc/ld.so.confÖС£ºÜ¶àÔ´ÓÚRed HatµÄ·¢ÐаæÒ»°ãÔÚÎļþ/etc/ld.so.confÖв»°üº¬/usr/local/lib.ÎÒÈÏΪÕâÊǸöBug,ÒªÔÚÔ´ÓÚRed HatµÄϵͳÀïÔËÐкܶà³ÌÐò¶¼ÐèÒª½øÐÐÒ»¸öͨÓõÄ"ÐÞ¸´",°Ñ/usr/local/lib¼ÓÈë/etc/ld.so.conf.
Èç¹ûÖ»ÊÇÏ븲¸Çij¸ö¿âÀïµÄÈô¸Éº¯Êý£¬¶øÏë±£Áô¸Ã¿âµÄÆäËü²¿·Ö£¬¿ÉÒÔÔÚ/etc/ld.so.preloadÖÐÊäÈëÒª¸²¸ÇµÄ¿âÃû£¨¡£oÎļþ£©£»ÕâЩ"Ô¤ÔØÈë"µÄ¿â»áÓÅÏÈÓÚ±ê×¼¿âʹÓá£Í¨³£ÕâÖÖÔ¤ÔØÈëÎļþÊÇÓÃÓÚ½ô¼±²¹¶¡µÄ£»·¢ÐаæÔÚ·¢ÐÐʱһ°ã²»»á°üº¬ÕâÑùµÄÎļþ¡£
ÔÚ³ÌÐòÆô¶¯Ê±Ñ°ÕÒËùÓÐÕâЩĿ¼̫»¨Ê±¼ä£¬ËùÒÔʵ¼ÊÉÏʹÓÃÁËÒ»¸öcache¹ÜÀí·½·¨¡£³ÌÐòldconfig£¨8£©È±Ê¡¶ÁÈëÎļþ/etc/ld.so.conf,ÔÚ¶¯Ì¬Á¬½ÓĿ¼ÀィÁ¢ÏàÓ¦µÄ·ûºÅÁ¬½Ó£¨ÕâÑù¾Í×ñÑ­Á˱ê×¼Ô¼¶¨£©£¬È»ºó°ÑcacheдÈë/etc/ld.so.cache,ÕâÑù¾Í¿ÉÒÔ±»ÆäËü³ÌÐòʹÓÃÁË¡£ËùÒÔÒ»µ©Ôö¼ÓÒ»¸öDLL,»òɾ³ýÒ»¸öDLL,»òÕßDLLĿ¼¼¯·¢Éú¸Ä±ä£¬ldconfig¾ÍÒªÔËÐÐÒ»´Î£»ÔÚ°²×°¿âʱ£¬ÔËÐÐldconfigͨ³£ÊÇÈí¼þ°ü¹ÜÀí³ÌÐòÐèÒªÖ´ÐеÄÒ»¸ö²½Öè¡£ÔÚÆô¶¯Ê±£¬³ÌÐòʹÓö¯Ì¬¼ÓÔسÌÐòÀ´¶ÁÈëÎļþ/etc/ld.so.cache,È»ºóÔØÈëÆäËùÐèµÄ¿â¡£
¸÷ÖÖ»·¾³±äÁ¿¿ÉÒÔ¿ØÖÆÕâÒ»¹ý³Ì£¬¶øÇÒÊÂʵÉÏÒ²ÓÐÔÊÐí¸²¸Ç´Ë¹ý³ÌµÄ»·¾³±äÁ¿£¨ËùÒÔ¿ÉÒÔÔÚij´ÎÌرðµÄÖ´Ðйý³ÌÖÐÁÙʱÌ滻ij¸ö²»Í¬µÄ¿â£©¡£ÔÚLinuxÏ£¬»·¾³±äÁ¿LD_LIBRARY_PATHÊÇÒ»×éÓöººÅ¸ô¿ªµÄĿ¼£¬ÔÚ²éÕÒ±ê׼Ŀ¼¼¯Ö®Ç°ÏȲéÕÒÕâЩ¿â£»ÕâÔÚµ÷ÊÔпâ»òΪÌØÊâÄ¿µÄʹÓ÷DZê×¼¿âʱºÜÓÐÓᣱäÁ¿LD_PRELOADÁгöÁ˸²¸Ç±ê×¼¼¯µÄº¯ÊýËùÔÚµÄÄ¿±êÎļþ£¬¾ÍÏñ/etc/ld.so.preloadÒ»Ñù¡£
Èç¹û²»²ÉÈ¡ÌرðµÄ´ëÊ©£¬ÔÊÐíÓû§¿ØÖƶ¯Ì¬Á¬½Ó¿â»á¶Ôsetuid/setgid³ÌÐòÔì³ÉÔÖÄÑÐԵĺó¹û¡£Òò´ËÔÚʵÏÖGNU glibcʱ£¬Èç¹ûÊÇsetuid»òsetgid³ÌÐò£¬½«ºöÂÔÕâЩ±äÁ¿£¨ºÍÆäËüÀàËƵıäÁ¿£©£¬»òÕßÑϸñÏÞÖÆÕâЩ±äÁ¿ËùÆðµÄ×÷Óá£GNUµÄglibc¿âͨ¹ý¼ì²é³ÌÐòµÄÖ¤Ã÷À´È·¶¨ÆäÊÇ·ñΪsetuid»òsetgid³ÌÐò£»Èç¹ûuidºÍeuid²»Í¬£¬»òÕßgidºÍegid²»Í¬£¬Ôò¿â¾Í¼ÙÉè¸Ã³ÌÐòΪsetuid/setgid³ÌÐò£¨»òÕßΪÆä×Ó³ÌÐò£©£¬È»ºóÑϸñÏÞÖÆËü¿ØÖÆÁ¬½ÓµÄÄÜÁ¦¡£Èç¹ûÔØÈëGNUµÄglibc¿â£¬¾Í¿ÉÒÔ¿´µ½ÕâÖÖÇé¿ö£»
ÇëÌرðÔĶÁÒ»ÏÂÎļþelf/rtld.cºÍsysdeps/generic/dl-sysdep.c.Õâ¾ÍÒâζ×ÅÈç¹ûʹuidºÍgidµÈÓÚeuidºÍegid,ÔÙµ÷ÓóÌÐò£¬ÕâЩ±äÁ¿¾Í¾ßÓÐÍêÈ«µÄЧÁ¦¡£ÆäËüÀàUnixϵͳ´¦ÀíÕâЩÇé¿öÓÐËù²»Í¬£¬µ«Ô­ÒòÏàͬ£ºÒ»¸ösetuid/setgid³ÌÐò²»Ó¦Êܵ½»·¾³±äÁ¿¼¯µÄ¹ý·ÖÓ°Ïì¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. zhoutingting ÓÚ 2012-03-10 22:13:05·¢±í:

    ѧϰÁË£¬Ð»Ð»Â¥Ö÷ÁË£¡