ÎåÖÖLinuxÖÐÓû§ID·Ö×éµÄ²î±ð·½·¨
¡¶LinuxÖÐÓû§IDµÄÎåÖÖ²î±ð·Ö×é·½·¨¡·
ÔÚLinux²Ù×÷ϵͳÖУ¬Óû§ID£¨User ID£©ÊÇÓÃÀ´±êʶ²î±ðÓû§µÄÊý×Ö¡£Óû§ID¾öÒéÁËÓû§ÔÚϵͳÖеÄȨÏ޺ͻá¼û¼¶±ð¡£³ýÁËͨË×Óû§£¬ÏµÍ³ÖÎÀíÔ±»¹¿ÉÒÔ½«Óû§·Ö×飬ÒÔ±ã¸üºÃµØÖÎÀíºÍ¿ØÖÆÓû§È¨ÏÞ¡£ÔÚLinuxÖУ¬Óû§IDµÄ·Ö×é·½·¨ÓжàÖÖ£¬ÏÂÃ潫ÏÈÈÝÎåÖÖ³£¼ûµÄ·Ö×é·½·¨£¬²¢¸½ÉÏÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢»ù±¾Óû§ID·Ö×é·½·¨£¨Primary User ID£©£º
ÔÚLinuxϵͳÖУ¬Ã¿¸öÓû§¶¼ÓÐÒ»¸ö»ù±¾Óû§ID£¬Ò²³ÆΪPrimary User ID¡£¸ÃIDÊÇÓû§ÔÚϵͳÖеÄÖ÷Òª±êʶ£¬¾öÒéÁËÓû§µÄ»á¼ûȨÏÞºÍ×ÊÔ´¿ØÖÆ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§µÄ»ù±¾Óû§ID£º
$ id -u
µÇ¼ºó¸´ÖÆ
¶þ¡¢¸½¼ÓÓû§ID·Ö×é·½·¨£¨Additional User ID£©£º
³ýÁË»ù±¾Óû§IDÍ⣬Linuxϵͳ»¹ÔÊÐíÓû§ÓµÓжà¸ö¸½¼ÓÓû§ID£¬Ò²³ÆΪAdditional User ID¡£Í¨¹ýÉèÖø½¼ÓÓû§ID£¬Óû§¿ÉÒÔÔÚ²î±ðÇéÐÎÏ»á¼û²î±ðµÄ×ÊÔ´¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§µÄËùÓÐÓû§ID£¨°üÀ¨»ù±¾Óû§IDºÍ¸½¼ÓÓû§ID£©£º
$ id
µÇ¼ºó¸´ÖÆ
Èý¡¢Óû§×éID·Ö×é·½·¨£¨Group ID£©£º
Óû§×éID£¨Group ID£©ÓÃÀ´½«²î±ðÓû§»®·Öµ½²î±ðµÄÓû§×éÖУ¬ÒÔ±ã¸üºÃµØÖÎÀíºÍ¿ØÖÆÓû§È¨ÏÞ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§ËùÊôµÄÓû§×飺
$ groups
µÇ¼ºó¸´ÖÆ
ËÄ¡¢¸½¼Ó×éID·Ö×é·½·¨£¨Additional Group ID£©£º
³ýÁËÓû§×éIDÍ⣬Linux»¹ÔÊÐíÓû§ÓµÓжà¸ö¸½¼Ó×éID£¬Ò²³ÆΪAdditional Group ID¡£Í¨¹ýÉèÖø½¼Ó×éID£¬Óû§¿ÉÒÔÔÚ²î±ðÓû§×éÖÐÓвî±ðµÄȨÏÞ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§µÄËùÓÐ×éID£¨°üÀ¨Óû§×éIDºÍ¸½¼Ó×éID£©£º
$ id -G
µÇ¼ºó¸´ÖÆ
Îå¡¢ÌØÊâÓû§ID·Ö×é·½·¨£¨Special User ID£©£º
ÌØÊâÓû§ID£¨Special User ID£©ÊÇÔÚÓû§»á¼ûϵͳʱ¾ßÓÐÌØÊâȨÏÞµÄÒ»ÖÖÓû§ID¡£ÆäÖУ¬³¬µÈÓû§£¨root£©ÊÇ×î¾ßÌØÊâÐÔµÄÓû§£¬ÓµÓÐϵͳÖеÄ×î¸ßȨÏÞ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§ÊÇ·ñÊdz¬µÈÓû§£º
$ sudo id
µÇ¼ºó¸´ÖÆ
×ܽ᣺
ÒÔÉÏÊÇLinuxÖÐÓû§IDµÄÎåÖÖ²î±ð·Ö×é·½·¨£¬Ã¿ÖÖ·½·¨¶¼ÓÐÆäÌض¨µÄ×÷ÓúÍÊÊÓó¡¾°¡£Í¨¹ýºÏÀíÉèÖÃÓû§IDµÄ·Ö×é·½·¨£¬¿ÉÒÔ¸üºÃµØÖÎÀíºÍ¿ØÖÆÓû§ÔÚϵͳÖеÄȨÏÞºÍ×ÊÔ´»á¼û¡£Ï£Íû¶ÁÕßÄܹ»Í¨¹ý±¾ÎÄÏàʶ¸ü¶à¹ØÓÚLinuxÓû§IDµÄ֪ʶ£¬²¢ÔÚÏÖʵӦÓÃÖÐÎÞаÔËÓá£
ÒÔÉϾÍÊÇÎåÖÖLinuxÖÐÓû§ID·Ö×éµÄ²î±ð·½·¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡