ÆÊÎöLinuxÓû§ID·ÖÀàºÍÓÃ;
LinuxÓû§ID·ÖÀ༰ÓÃ;ÆÊÎö
ÔÚLinuxϵͳÖУ¬Ã¿¸öÓû§¶¼ÓÐÒ»¸öΨһµÄÓû§ID£¨UID£©ºÍÒ»¸ö×éID£¨GID£©£¬ÕâЩID±»ÓÃÓÚ±êʶÓû§²¢È·¶¨ÆäȨÏÞÒÔ¼°ËùÊôµÄÓû§×é¡£ÔÚ±¾ÎÄÖУ¬½«ÏêϸÆÊÎöLinuxÖÐÓû§IDµÄ·ÖÀ༰ÓÃ;£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢Óû§ID·ÖÀà
ϵͳÓû§£º
ϵͳÓû§ÊÇÓÃÓÚÔËÐÐϵͳЧÀͺÍÀú³ÌµÄÌØÊâÓû§£¬ËüÃÇͨ³£Ã»ÓеǼȨÏÞ£¬²¢ÇÒUIDֵͨ³£½ÏС£¨Í¨³£ÔÚ0-999Ö®¼ä£©¡£ÏµÍ³Óû§µÄ×÷ÓÃÊÇÈ·±£ÏµÍ³Ð§À͵ÄÇå¾²²¢×èÖ¹ÓëͨË×Óû§µÄIDÖصþ¡£
ͨË×Óû§£º
ͨË×Óû§ÊÇϵͳÖеÄͨË×Óû§£¬ËûÃÇͨ³£¾ßÓеǼȨÏÞ²¢¿ÉÒÔÖ´ÐÐÖݪֲÙ×÷¡£Í¨Ë×Óû§µÄUIDֵͨ³£´Ó1000×îÏÈ£¬²¢Æ¾Ö¤½¨Éè˳ÐòµÝÔö¡£
ÌØÊâÓû§£º
ÌØÊâÓû§Í¨³£Ö¸³¬µÈÓû§£¨root£©ºÍ×飨wheel£©³ÉÔ±£¬ËûÃÇÓµÓÐϵͳÖÐ×î¸ß¼¶±ðµÄȨÏÞ¡£³¬µÈÓû§µÄUIDÊÇ0£¬¶ø×飨wheel£©³ÉÔ±µÄUID¿ÉÒÔƾ֤ÐèÒª×Ô½ç˵¡£
¶þ¡¢Óû§IDÓÃ;ÆÊÎö
È·¶¨Óû§È¨ÏÞ£º
Óû§IDÔÚLinuxϵͳÖÐÆð×ÅÖÁ¹ØÖ÷ÒªµÄ×÷Óã¬ËüÈ·¶¨ÁËÓû§¶ÔÎļþºÍĿ¼µÄ¶Á¡¢Ð´ºÍÖ´ÐÐȨÏÞ¡£Í¨¹ýUIDºÍGID£¬ÏµÍ³¿ÉÒÔÓÐÓõØÖÎÀíÎļþµÄ»á¼û¿ØÖÆ£¬²¢È·±£Êý¾ÝµÄÇå¾²ÐÔ¡£
Çл»Óû§Éí·Ý£º
ÔÚLinuxϵͳÖУ¬¿ÉÒÔʹÓÃsu»òsudoÏÂÁîÀÍÆÈ´»Óû§Éí·Ý¡£ÕâЩÏÂÁîÒÀÀµÓÚÓû§IDÀ´È·¶¨Óû§ÊÇ·ñÓÐȨÏÞÖ´ÐÐÌض¨²Ù×÷¡£ÀýÈ磬ʹÓÃsudo¿ÉÒÔÈÃͨË×Óû§ÔÝʱ»ñÈ¡³¬µÈÓû§È¨ÏÞÀ´Ö´ÐÐÌض¨Ê¹Ãü¡£
È·¶¨ÎļþËùÓÐÕߣº
ÿ¸öÎļþ»òĿ¼ÔÚϵͳÖж¼ÓÐÒ»¸öËùÓÐÕߺÍËùÊô×飬ÕâЩÐÅÏ¢¶¼ÊÇͨ¹ýÓû§IDÀ´È·¶¨µÄ¡£Í¨¹ýÓû§ID£¬ÏµÍ³¿ÉÒÔʶ±ðÎļþµÄËùÓÐÕß²¢È·¶¨ÆäȨÏÞ¡£
´úÂëʾÀý£º
Éó²éÄ¿½ñÓû§ID¼°ËùÊô×éIDµÄÏÂÁ
id
µÇ¼ºó¸´ÖÆ
½¨ÉèÒ»¸öϵͳÓû§²¢Ö¸¶¨UID£º
sudo useradd -r -u 5000 myuser
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄÎļþËùÓÐÕߺÍËùÊô×飺
chown myuser:mygroup myfile.txt
µÇ¼ºó¸´ÖÆ
×ܽ᣺
Óû§IDÔÚLinuxϵͳÖÐÊÎÑÝ×ÅÖÁ¹ØÖ÷ÒªµÄ½ÇÉ«£¬Ëü²»µ«È·¶¨ÁËÓû§µÄȨÏÞ£¬»¹Ó°ÏìÁËϵͳµÄÇå¾²ÐԺͻá¼û¿ØÖÆ¡£Í¨¹ý¶ÔÓû§IDµÄ·ÖÀ༰ÓÃ;¾ÙÐÐÆÊÎö£¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÃ÷È·LinuxϵͳÖÐÓû§ÖÎÀíµÄÔÀí£¬²¢¸üÓÐÓõؾÙÐÐȨÏÞ¿ØÖƺÍÉí·ÝÇл»¡£
ÒÔÉϾÍÊÇÆÊÎöLinuxÓû§ID·ÖÀàºÍÓÃ;µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡