ÔõÑùÉó²éLinuxϵͳÖеÄÄ¿½ñÓû§
LinuxÓû§ÖÎÀí£ºÔõÑùÉó²éÄ¿½ñÓû§Ãû
ÔÚLinuxϵͳÖУ¬Óû§ÊÇϵͳµÄÖ÷Òª×é³É²¿·Ö¡£ÏàʶÔõÑùÉó²éÄ¿½ñÓû§ÃûÊÇʹÓÃLinuxϵͳµÄ»ù´¡Ö®Ò»¡£±¾ÎĽ«ÏÈÈÝÔÚLinuxϵͳÖÐÔõÑùÉó²éÄ¿½ñÓû§Ãû£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢Éó²éÄ¿½ñÓû§ÃûµÄÏÂÁî
ÔÚLinuxϵͳÖУ¬¿ÉÒÔʹÓÃwhoamiÏÂÁîÀ´Éó²éÄ¿½ñÓû§Ãû¡£whoamiÏÂÁî»áÏÔʾĿ½ñµÇÈÎÃü»§µÄÓû§Ãû¡£
ʾÀý´úÂ룺
whoami
µÇ¼ºó¸´ÖÆ
¶þ¡¢Éó²éÄ¿½ñÓû§ÃûµÄÁíÒ»ÖÖ·½·¨
³ýÁËʹÓÃwhoamiÏÂÁ»¹¿ÉÒÔʹÓÃidÏÂÁîÀ´Éó²éÄ¿½ñÓû§Ãû¡£idÏÂÁî»áÏÔʾĿ½ñÓû§µÄÓû§IDºÍËùÊô×éµÄID¡£
ʾÀý´úÂ룺
id -u -n
µÇ¼ºó¸´ÖÆ
Èý¡¢Éó²éÄ¿½ñÓû§ÃûµÄµÚÈýÖÖÒªÁì
»¹¿ÉÒÔͨ¹ýÇéÐαäÁ¿$USERÀ´Éó²éÄ¿½ñÓû§Ãû¡£$USERÉúÑÄÁËÄ¿½ñÓû§µÄÓû§ÃûÐÅÏ¢¡£
ʾÀý´úÂ룺
echo $USER
µÇ¼ºó¸´ÖÆ
ËÄ¡¢Æ¾Ö¤²î±ðÇéÐÎÑ¡ÔñºÏÊʵÄÏÂÁî
ÔÚÏÖʵӦÓÃÖУ¬Æ¾Ö¤²î±ðµÄÐèÇóºÍÇéÐΣ¬¿ÉÒÔÑ¡Ôñ²î±ðµÄÏÂÁîÀ´Éó²éÄ¿½ñÓû§Ãû¡£ÈôÊÇÖ»ÐèÒª¼òÆÓµØÉó²éÄ¿½ñÓû§Ãû£¬Ê¹ÓÃwhoami¿ÉÄܸüΪÀû±ã£»ÈôÊÇÐèÒªÉó²é¸üÏêϸµÄÓû§ÐÅÏ¢£¬Ôò¿ÉÒÔÑ¡ÔñidÏÂÁÈôÊÇÐèÒªÔھ籾ÖлñÈ¡Ä¿½ñÓû§Ãû£¬¿ÉÒÔʹÓÃ$USERÇéÐαäÁ¿¡£
Îå¡¢×ܽá
±¾ÎÄÏÈÈÝÁËÔÚLinuxϵͳÖÐÔõÑùÉó²éÄ¿½ñÓû§ÃûµÄÈýÖÖÒªÁ죬²¢ÌṩÁËÏêϸµÄ´úÂëʾÀý¡£ÏàʶÔõÑùÉó²éÄ¿½ñÓû§ÃûÊÇʹÓÃLinuxϵͳµÄ»ù´¡Ö®Ò»£¬Ï£Íû±¾ÎĶԳõѧÕßÄÜÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùÉó²éLinuxϵͳÖеÄÄ¿½ñÓû§µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡