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

ÇÉÓÃLinux2.6ÄÚºËй¦ÄÜÅäÖÃÎļþACL

·¢²¼Ê±¼ä:2005-11-06 19:16:45À´Ô´:ºìÁª×÷Õß:Myiozzdoc
Èç¹ûʹÓùýUnix£¬¾Í²»»á¶ÔACL(Access Control List£¬·ÃÎÊ¿ØÖÆÁбí)¸Ðµ½Ä°Éú¡£ÔÚLinux 2.4ÄÚºËÖУ¬ACL×÷Ϊ²¹¶¡´æÔÚ£¬¶øÔÚ2.6ÐÂÄÚºËÖУ¬ËüÒѾ­ÊDZê×¼Äں˵ÄÒ»²¿·ÖÁË¡£

´«Í³UnixµÄACL£¬Ö»ÄܶÔÎļþÉ趨Óû§¡¢×éºÍÆäËûÈ˵ÄȨÏÞ£¬Ò²¾ÍÊÇÎÒÃdz£ÓõÄ755¡¢644Ö®ÀàµÄȨÏÞ¡£Èç¹ûÏëΪһ¸öÎļþ½»²æ¶¨ÒåÈô¸É¸ö²»Í¬×éµÄÓû§·ÃÎÊȨÏÞ£¬±ÈÈç˵tom¡¢mary¡¢tony¡¢tod·Ö±ðÊôÓÚ²»Í¬µÄ×飬ijһÎļþÏëÈÃmaryºÍtonyÖ»¶Á£¬tomºÍtod¿Éд£¬ÆäËûÓû§²»¿É·ÃÎÊ¡£ÕâÖÖÒªÇóÓô«Í³µÄUnix ACLÊÇÎÞ·¨ÊµÏֵġ£

Linux 2.6ÄÚºËÖеÄACLÕýÊÇΪӦ¸¶ÀàËƵÄÐèÇóËùÉè¼ÆµÄ¡£Ëü¿ÉÒÔ·½±ãµØΪÎļþÅäÖÃÈÎÒâÓû§ºÍ×éµÄ·ÃÎÊȨÏÞ¡£

ÒªÏëʹÓÃACL¹¦ÄÜ£¬Ê×ÏÈÐèÒªÕýÈ·±àÒë2.6Äںˣ¬²¢È·±£ÓÐÏÂÁÐÑ¡Ï


CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_FS_POSIX_ACL=y




ÓÃÐÂÄÚºËÆô¶¯ºó£¬»¹ÒªÇóÔÚ¹ÒÔØ·ÖÇøµÄʱºòÌí¼Ó±ØÒªµÄ²ÎÊý¡°acl¡±¡£


mount -t ext3 -o rw,
acl /dev/hda8 /your_mount_point




»òÔÚ /etc/fstab ÖмÓÈëÏÂÁÐÐУ¬ÊµÏÖ×Ô¶¯mount·ÖÇø²¢ÇÒ´øÓС°acl¡±²ÎÊý¡£


/dev/hda8 ext3 /your_mount_point defaults,
acl 1 1




ÕýÈ·¹ÒÔØÎļþϵͳºó£¬¾Í¿ÉÒÔʹÓÃACLµÄÃüÁîÀ´ÐÞ¸ÄÎļþµÄACLÊôÐÔÁË¡£ÐÞ¸ÄACLÊôÐÔµÄÃüÁîÓÐsetfacl¡¢getfacl ºÍchacl£¬ÆäÖÐchaclÊÇÒ»¸öSGI IRIX¼æÈÝÃüÁÖ÷ÒªÊÊÓÃÓÚÄÇЩ¶ÔSGI IRIXÒÔ¼°XFSÎļþϵͳ±È½ÏÊìϤµÄÓû§¡£±¾ÎÄÖ»½éÉÜsetfaclºÍgetfaclÃüÁ¾ßÌåÓ÷¨ÈçÏÂÃæµÄÀý×Ó£º

1.ʹÎļþ1.txt¿ÉÒÔ±»Óû§test¶Áд


setfacl -m u:test:rw 1.txt




2.ʹÎļþ1.txt¿ÉÒÔ±»qmail×éµÄ×éÔ±¶Á£¬µ«²»ÄÜд


setfacl -m g:qmail:r 1.txt




3.°ÑijһÎļþµÄACLÊôÐÔcopy¸øÁíÒ»Îļþ£¬±ÈÈç°ÑÎļþ1.txtµÄACLÊôÐÔcopy¸ø2.txt£º


getfacl 1.txt | setfacl -set-file=- 2.txt




4.ͬʱΪÎļþÉèÖò»Í¬Óû§»ò×éµÄȨÏÞ

±ÈÈç¶ÔÎļþ2.txtÉ趨testmailÓû§¿É¶Áд£¬qmail×é×éÔ±¿É¶Á¿ÉÖ´ÐУ¬nofiles ×é×éÔ±¿ÉÖ´ÐÐ:


setfacl -m u:testmail:rw,
g:qmail:rx,g:nofiles:x 2.txt




²é¿´man page¿É»ñµÃsetfactºÍgetfaclÃüÁî¸üÏêϸµÄÓ÷¨¡£

ÔÚϵͳ¹ÜÀíÔ±µÄ¹¤×÷ÖУ¬Óöµ½µÄ×î´óµÄÀ§ÄÑÍùÍù²»ÊǸßÄѶȵÄÄÚºËÎÊÌ⣬Ҳ²»ÊÇÅäÖÃApache·þÎñÆ÷Ö®ÀàµÄÎÊÌ⣬¶øÊÇ¿ØÖÆÎļþ·ÃÎÊȨÏÞµÄÎÊÌâ¡£Ö÷¹ÜÁìµ¼³£³£»áÌá³ö·Ç³£ÌرðµÄÒªÇó£¬È¨ÏÞÅäÖþ­³£¾ßÌåµ½ÈË£¬ÕâÔÚÅäÖÃÎļþ·þÎñÆ÷Sambaʱ·Ç³£ÄÑÓÚʵÏÖ£¬Ê¹ÓÃ2.6ÄÚºËÖеÄACL£¨·ÃÎÊ¿ØÖÆÁÐ±í£©Ð¹¦ÄÜ£¬ÎÊÌâ¾Í»áÓ­Èжø½â¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. ming ÓÚ 2005-11-14 00:37:22·¢±í:

    ÕâƪÎÄÕ²»´í£¬Ö§³Ö¸ö