ÖÎÀíLinuxÓû§£ºÁгöËùÓÐÓû§
LinuxÓû§ÖÎÀí£ºÉó²éËùÓÐÓû§£¬ÐèÒªÏêϸ´úÂëʾÀý
ÔÚLinuxϵͳÖУ¬Óû§ÖÎÀíÊÇϵͳÖÎÀíµÄÖ÷ÒªÒ»²¿·Ö¡£ÏàʶºÍÉó²éËùÓÐÓû§ÊDZز»¿ÉÉٵIJÙ×÷Ö®Ò»£¬±¾ÎĽ«ÏÈÈÝÔõÑùÉó²éËùÓÐÓû§µÄÒªÁì²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
ÒªÉó²éËùÓÐÓû§£¬¿ÉÒÔʹÓÃÒÔϼ¸ÖÖÒªÁ죺
ʹÓÃcatÏÂÁîÉó²é/etc/passwdÎļþ
ÔÚLinuxϵͳÖУ¬ËùÓÐÓû§µÄÐÅÏ¢¶¼ÉúÑÄÔÚ/etc/passwdÎļþÖС£ÎÒÃÇ¿ÉÒÔʹÓÃcatÏÂÁîÀ´Éó²é¸ÃÎļþµÄÄÚÈÝ£¬´Ó¶ø»ñÈ¡ËùÓÐÓû§µÄÐÅÏ¢¡£
cat /etc/passwd
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÉÏÊöÏÂÁîºó£¬ÏµÍ³»áÁгöËùÓÐÓû§µÄÐÅÏ¢£¬Ã¿¸öÓû§Õ¼ÓÃÒ»ÐУ¬°üÀ¨Óû§Ãû³Æ¡¢Óû§ID¡¢×éID¡¢Óû§ÐÅÏ¢¡¢Ö÷Ŀ¼ºÍShellµÈ¡£Í¨¹ý¸ÃÒªÁì¿ÉÒÔÉó²éϵͳÖÐËùÓÐÓû§µÄ»ù±¾ÐÅÏ¢¡£
ʹÓÃcutÏÂÁî¹ýÂËÌض¨×Ö¶Î
ÈôÊÇÖ»ÏëÁгöËùÓÐÓû§Ãû¶ø²»°üÀ¨ÆäËûÐÅÏ¢£¬¿ÉÒÔÍŽáʹÓÃcutÏÂÁîÀ´¹ýÂËÌض¨×ֶΡ£
cat /etc/passwd | cut -d: -f1
µÇ¼ºó¸´ÖÆ
ÉÏÊöÏÂÁîÖУ¬-dÑ¡ÏîÖ¸¶¨ÁË×ֶεÄÍÑÀë·ûΪðºÅ¡°:¡±£¬-fÑ¡ÏîÖ¸¶¨ÁËÒªÌáÈ¡µÄ×Ö¶ÎΪµÚÒ»¸ö×ֶΣ¬¼´Óû§Ãû¡£Ö´ÐиÃÏÂÁîºó£¬ÏµÍ³½«ÁгöËùÓÐÓû§Ãû£¬Àû±ãÉó²éËùÓÐÓû§µÄÃû³Æ¡£
ʹÓÃgetentÏÂÁîÉó²éËùÓÐÓû§
getentÏÂÁî¿ÉÒÔÓÃÀ´»ñÈ¡Êý¾Ý¿âÖеÄËùÓÐÐÅÏ¢£¬°üÀ¨Óû§¡¢×é¡¢Ö÷»úµÈ¡£ÎÒÃÇ¿ÉÒÔʹÓÃgetentÏÂÁîÍŽápasswdÊý¾Ý¿âÀ´Éó²éËùÓÐÓû§µÄÐÅÏ¢¡£
getent passwd
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÉÏÊöÏÂÁîºó£¬ÏµÍ³»áÁгöËùÓÐÓû§µÄÏêϸÐÅÏ¢£¬°üÀ¨Óû§Ãû³Æ¡¢Óû§ID¡¢×éID¡¢Óû§ÐÅÏ¢¡¢Ö÷Ŀ¼ºÍShellµÈ¡£Óëcat /etc/passwdÏÂÁîÏà±È£¬getentÏÂÁîչʾµÄÐÅÏ¢Ô½·¢ÖÜÈ«ºÍÏêϸ¡£
ͨ¹ýÒÔÉÏÈýÖÖÒªÁ죬ÎÒÃÇ¿ÉÒÔÇáËÉÉó²éLinuxϵͳÖеÄËùÓÐÓû§£¬²¢»ñÈ¡ËûÃǵĻù±¾ÐÅÏ¢¡£Óû§ÖÎÀíÊÇϵͳÖÎÀíµÄ»ù´¡Ö®Ò»£¬ÊìÁ·ÕÆÎÕÓû§ÖÎÀíÏà¹Ø²Ù×÷¹ØÓÚÖÎÀíLinuxϵͳÖÁ¹ØÖ÷Òª¡£Ï£Íû±¾ÎÄÌṩµÄ´úÂëʾÀýÄÜ×ÊÖú¶ÁÕ߸üºÃµØÏàʶºÍÕÆÎÕLinuxÓû§ÖÎÀíµÄÏà¹Ø֪ʶ¡£
ÒÔÉϾÍÊÇÖÎÀíLinuxÓû§£ºÁгöËùÓÐÓû§µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡