ÔõÑùÔÚLinuxÉÏÉèÖÃÎļþȨÏÞ
ÔõÑùÔÚlinuxÉÏÉèÖÃÎļþȨÏÞ
ÔÚLinuxϵͳÖУ¬ÎļþµÄȨÏÞÊǺÜÊÇÖ÷ÒªµÄ£¬Ëü¾öÒéÁËÓû§¶ÔÎļþµÄ»á¼û¼¶±ð¡£ÎļþȨÏÞ·ÖΪÈý¸ö²¿·Ö£ºËùÓÐÕß¡¢Èº×éºÍÆäËûÈË¡£Í¨¹ýÉèÖÃÊʵ±µÄÎļþȨÏÞ£¬¿ÉÒÔÈ·±£Ö»ÓÐÊÚȨµÄÓû§²Å»ª»á¼û»òÐÞ¸ÄÎļþ¡£ÏÂÃ潫ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖÃÎļþȨÏÞ£¬²¢ÌṩһЩʵÀý´úÂ빩²Î¿¼¡£
Éó²éÄ¿½ñÎļþȨÏÞ
ÔÚ×îÏÈÉèÖÃÎļþȨÏÞ֮ǰ£¬ÎÒÃÇÐèÒªÏÈÉó²éÄ¿½ñÎļþµÄȨÏÞ¡£¿ÉÒÔʹÓÃls -lÏÂÁîÀ´ÁгöÎļþµÄÏêϸÐÅÏ¢£¬°üÀ¨ÎļþµÄȨÏÞÐÅÏ¢¡£ÀýÈ磬ÎÒÃÇÏëÉó²éÎļþexample.txtµÄȨÏÞ£¬¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
ls -l example.txt
µÇ¼ºó¸´ÖÆ
Õ⽫Êä³öÀàËÆÓÚÒÔÏÂÄÚÈÝ£º
-rw-r--r-- 1 user group 0 Jan 1 2022 example.txt
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬rw-r–r–ÌåÏÖÎļþµÄȨÏÞ¡£µÚÒ»¸ö×Ö·û-ÌåÏÖÕâÊÇÒ»¸öͨË×Îļþ£¬ÈôÊÇÊÇĿ¼£¬ÄÇôÏÔʾΪd¡£½ÓÏÂÀ´µÄÈý¸ö×Ö·ûrw-ÌåÏÖÎļþËùÓÐÕßµÄȨÏÞ£¬½ÓÏÂÀ´µÄÈý¸ö×Ö·ûr–ÌåÏÖÎļþËùÊôȺ×éµÄȨÏÞ£¬×îºóµÄÈý¸ö×Ö·ûr–ÌåÏÖÆäËûÈ˵ÄȨÏÞ¡£
ÉèÖÃÎļþȨÏÞ
ÉèÖÃÎļþȨÏÞÖ÷ҪʹÓÃchmodÏÂÁî¡£chmodÏÂÁîµÄ»ù±¾Óï·¨ÊÇ£º
chmod [ȨÏÞģʽ] ÎļþÃû
µÇ¼ºó¸´ÖÆ
ȨÏÞģʽ¿ÉÒÔʹÓÃÊý×Öģʽ»ò·ûºÅģʽÀ´ÌåÏÖ¡£
ʹÓÃÊý×ÖģʽÉèÖÃȨÏÞ
Êý×ÖģʽÊÇ×î³£Óõķ½·¨À´ÉèÖÃÎļþȨÏÞ¡£Ã¿¸öÎļþȨÏÞ¶¼ÓÃÒ»¸öÊý×ÖÌåÏÖ£¬¶ÁȨÏÞΪ4£¬Ð´È¨ÏÞΪ2£¬Ö´ÐÐȨÏÞΪ1¡£ËùÓÐÕß¡¢Èº×éºÍÆäËûÈ˵ÄȨÏÞ»®·ÖÓÃÈýλÊý×ÖÌåÏÖ¡£ÀýÈ磬½«Îļþexample.txtµÄȨÏÞÉèÖÃΪËùÓÐÕ߿ɶÁ¿Éд£¬Èº×éºÍÆäËûÈËÖ»¶Á£¬¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
chmod 644 example.txt
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Õ⽫°ÑÎļþexample.txtµÄȨÏÞÉèÖÃΪ-rw-r–r–¡£
ʹÓ÷ûºÅģʽÉèÖÃȨÏÞ
·ûºÅģʽ¸üÖ±¹ÛºÍÒ×ÓÚÓ°Ïó£¬ËüʹÓüӺţ¨+£©ºÍ¼õºÅ£¨-£©À´Ìí¼ÓºÍɾ³ýȨÏÞ¡£ÒÔÏÂÊÇһЩ·ûºÅģʽµÄʾÀý£º
Ìí¼ÓȨÏÞ£º+ ÌåÏÖÌí¼ÓȨÏÞ¡£
ɾ³ýȨÏÞ£º- ÌåÏÖɾ³ýȨÏÞ¡£
ij¸öȨÏÞ£ºr ÌåÏÖ¶ÁȨÏÞ£¬w ÌåÏÖдȨÏÞ£¬x ÌåÏÖÖ´ÐÐȨÏÞ¡£
ËùÓÐÕß¡¢Èº×éºÍÆäËûÈË£ºu ÌåÏÖËùÓÐÕߣ¬g ÌåÏÖȺ×飬o ÌåÏÖÆäËûÈË£¬a ÌåÏÖËùÓÐÈË¡£
ÀýÈ磬½«Îļþexample.txtµÄȨÏÞÉèÖÃΪËùÓÐÕß¿Éд£¬Èº×éºÍÆäËûÈËÖ»¶Á£¬¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
chmod u+w,go-w example.txt
µÇ¼ºó¸´ÖÆ
Õ⽫°ÑÎļþexample.txtµÄȨÏÞÉèÖÃΪ-rw-r–r–¡£
ʵÀý´úÂëʾÀý
ÒÔÏÂÊÇһЩÎļþȨÏÞÉèÖõÄʵÀý´úÂ룺
ÉèÖÃÎļþËùÓÐÕ߿ɶÁ¿Éд£¬Èº×éºÍÆäËûÈËÖ»¶Á£º
chmod 644 example.txt
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÉèÖÃÎļþËùÓÐÕ߿ɶÁдºÍÖ´ÐУ¬Èº×éºÍÆäËûÈËÖ»¶ÁºÍÖ´ÐУº
chmod 755 script.sh
µÇ¼ºó¸´ÖÆ
Ìí¼ÓÎļþËùÓÐÕߺÍȺ×éµÄÖ´ÐÐȨÏÞ£º
chmod +x script.sh
µÇ¼ºó¸´ÖÆ
ɾ³ýÎļþÆäËûÈ˵ÄдȨÏÞ£º
chmod o-w example.txt
µÇ¼ºó¸´ÖÆ
ͨ¹ýÕâЩʵÀý´úÂ룬¿ÉÒÔºÜÈÝÒ×µØƾ֤ÐèÒªÉèÖÃÎļþµÄȨÏÞ¡£
×ܽá
ÎļþȨÏÞÔÚLinuxϵͳÖÐÆð×ÅÖÁ¹ØÖ÷ÒªµÄ×÷Óã¬Í¨¹ý׼ȷÉèÖÃÎļþȨÏÞ£¬¿ÉÒÔÈ·±£ÎļþµÄÇå¾²ÐԺͿɻá¼ûÐÔ¡£±¾ÎÄÏÈÈÝÁËÔõÑùÔÚlinuxÉÏÉèÖÃÎļþȨÏÞ£¬²¢ÌṩÁËһЩʵÀý´úÂ빩²Î¿¼¡£Í¨¹ýѧϰºÍÕÆÎÕÎļþȨÏÞµÄÉèÖÃÒªÁ죬¿ÉÒÔ¸üºÃµØ±£»¤ÎļþµÄÇå¾²ÐÔ¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖÃÎļþȨÏÞµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡