¡¡¡¡ÓÉÓÚFreeBSDÊÇÒ»¸ö¶àÓû§ÏµÍ³£¬ÄÇô¾ÍÐèÒª¹ÜÀíÔ±½øÐÐÈÕ³£Î¬»¤£¬ÌرðÊÇÓÃ×öÍøÂç·þÎñÆ÷µÄϵͳ£¬Ò»µ©ÒòΪ ȱ·¦Î¬»¤¶øÔì³ÉÍ£»ú¹ÊÕÏ£¬¾Í»áÔì³ÉºÜ´óËðʧ¡£¼´Ê¹¶ÔÓÚµ¥Óû§µÄFreeBSDϵͳ£¬Í¬ÑùÒ²ÒªÖ´ÐÐÕâЩ²»¿Éȱ·¦µÄά»¤ÈÎ Îñ£¬Ö»ÊÇÓÉÓÚϵͳ¹é¸öÈËʹÓã¬ÄÇô¶Ôά»¤µÄÒªÇó¾Í²»±ØÄÇô¸ß£¬Î¬»¤ÈÎÎñ¾ÍÇáËÉһЩ¡£
¡¡¡¡ÏµÍ³ÈÕÖ¾
¡¡¡¡ÏµÍ³µÄÈÕÖ¾¼Ç¼ÌṩÁ˶Ôϵͳ»î¶¯µÄÏêϸÉó¼Æ£¬ÕâЩÈÕÖ¾ÓÃÓÚÆÀ¹À¡¢Éó²éϵͳµÄÔËÐл·¾³ºÍ¸÷ÖÖ²Ù×÷¡£¶ÔÓÚÒ»°ãÇé¿ö £¬ÈÕÖ¾¼Ç¼°üÀ¨¼Ç¼Óû§µÇ¼ʱ¼ä¡¢µÇ¼µØµã¡¢½øÐÐʲô²Ù×÷µÈÄÚÈÝ£¬Èç¹ûʹÓõõ±£¬ÈÕÖ¾¼Ç¼ÄÜÏòϵͳ¹ÜÀíÔ±ÌṩÓйØΣº¦ °²È«µÄÇÖº¦»òÈëÇÖÊÔͼµÈ·Ç³£ÓÐÓõÄÐÅÏ¢¡£
¡¡¡¡BSDÌṩÁËÏêϸµÄ¸÷ÖÖÈÕÖ¾¼Ç¼£¬ÒÔ¼°ÓйØÈÕÖ¾µÄ´óÁ¿¹¤¾ßºÍʵÓóÌÐò¡£ÕâЩÉó¼Æ¼Ç¼ͨ³£ÓɳÌÐò×Ô¶¯²úÉú£¬ÊÇȱ Ê¡ÉèÖõÄÒ»²¿·Ö£¬Äܹ»°ïÖúUnix¹ÜÀíÔ±À´Ñ°ÕÒϵͳÖдæÔÚµÄÎÊÌ⣬¶Ôϵͳά»¤Ê®·ÖÓÐÓ᣻¹ÓÐÁíһЩÈÕÖ¾¼Ç¼£¬ÐèÒª¹ÜÀí Ô±½øÐÐÉèÖòÅÄÜÉúЧ¡£´ó²¿·ÖÈÕÖ¾¼Ç¼Îļþ±»±£´æÔÚ/var/logĿ¼ÖУ¬ÔÚÕâ¸öĿ¼ÖгýÁ˱£´æϵͳÉú³ÉÈÕÖ¾Ö®Í⣬»¹ °üÀ¨Ò»Ð©Ó¦ÓÃÈí¼þµÄÈÕÖ¾Îļþ¡£µ±È»/varĿ¼ÏµÄÆäËû×ÓĿ¼ÖÐÒ²»á¼Ç¼ÏÂһЩÆäËûÖÖÀàµÄÈÕÖ¾¼Ç¼Îļþ£¬ÕâÒÀÀµÓÚ¾ßÌå µÄÓ¦ÓóÌÐòµÄÉèÖá£
¡¡¡¡ÏµÍ³µÇ¼ÈÕÖ¾
¡¡¡¡ÏµÍ³»á±£´æÿ¸öÓû§µÄµÇ¼¼Ç¼£¬ÕâЩÐÅÏ¢°üÀ¨Õâ¸öÓû§µÄÃû×Ö¡¢µÇ¼Æðʼ½áÊøʱ¼äÒÔ¼°´ÓºÎ´¦µÇ¼ÈëϵͳµÄµÈµÈ¡£ ËüÃDZ»±£´æµ½/var/log/lastlog¡¢/var/log/wtmpºÍ/var/run/utmpÎļþÖУ¬Õâ Èý¸öÎļþÒÔ¶þ½øÖƸñʽ±£´æÁËÕâЩÓû§µÄµÇ¼Êý¾Ý¡£
¡¡¡¡ÆäÖÐ/var/run/utmpÎļþÖб£´æµÄÊǵ±Ç°ÏµÍ³Óû§µÄµÇ¼¼Ç¼£¬Òò´ËÕâ¸öÎļþ»áËæ×ÅÓû§½øÈëºÍÀ뿪ϵ ͳ¶ø²»¶Ï±ä»¯£¬¶øËüÒ²²»»áΪÓû§±£ÁôºÜ³¤µÄ¼Ç¼£¬Ö»±£Áôµ±Ê±Áª»úµÄÓû§¼Ç¼¡£ÏµÍ³ÖÐÐèÒª²éѯµ±Ç°Óû§×´Ì¬µÄ³ÌÐò£¬Èç who¡¢wµÈ¾ÍÐèÒª·ÃÎÊÕâ¸öÎļþ¡£utmp¿ÉÄܲ»°üÀ¨ËùÓо«È·µÄÐÅÏ¢£¬Ä³Ð©Í»·¢´íÎó»áÖÕÖ¹Óû§µÇ¼»á»°£¬µ±Ã»Óм°Ê±¸üРutmp¼Ç¼£¬Òò´ËutmpµÄ¼Ç¼²»ÊÇ°Ù·ÖÖ®°ÙµÄ¿ÉÒÔÐÅÀµµÄ¡£
¡¡¡¡¶ø/var/log/wtmp±£´æÁËËùÓеĵǼ¡¢Í˳öÐÅÏ¢£¬ÒÔ¼°ÏµÍ³µÄÆô¶¯¡¢Í£»ú¼Ç¼£¬Òò´ËËæ×ÅϵͳÕý³£ÔËÐРʱ¼äµÄÔö¼Ó£¬ËüµÄ´óСҲ»áÔ½À´Ô½´ó£¬Ôö¼ÓµÄËÙ¶ÈÒÀÀµÓÚϵͳÓû§µÇ¼´ÎÊý¡£Òò´Ë¿ÉÒÔÀûÓÃÕâ¸öÈÕÖ¾ÓÃÀ´²é¿´Óû§µÄµÇ¼¼Ç¼ £¬lastÃüÁî¾Íͨ¹ý·ÃÎÊÕâ¸öÎļþÀ´»ñµÃÕâЩÐÅÏ¢£¬²¢ÒÔ·´Ðò´ÓºóÏòÇ°ÏÔʾÓû§µÄµÇ¼¼Ç¼£¬lastÒ²Äܸù¾ÝÓû§¡¢ÖÕ¶Ë tty»òʱ¼äÏÔʾÏàÓ¦µÄ¼Ç¼¡£acÃüÁîͬÑùҲʹÓÃwtmpÖеÄÊý¾Ý²úÉú±¨¸æ£¬µ«ËüµÄÏÔʾ·½Ê½²»Í¬¡£Ëü¿ÉÒÔ¸ù¾ÝÓû§£¨ac -p£© £¬»ò°´ÈÕÆÚ£¨ap -d£©ÏÔʾÐÅÏ¢£¬ÕâÑù¹ÜÀíÔ±¾ÍÄÜ»ñµÃһЩ·Ç³£ÓÐÓõķ´³£ÐÅÏ¢£¬ÈçÒ»¸öƽʱ²»Ì«»îÔ¾µÄÓû§ ͻȻµÇ¼²¢Á¬½ÓºÜ³¤Ê±¼ä£¬¾ÍÓÐÀíÓÉ»³ÒÉÕâ¸öÕÊ»§±»ÇÔÈ¡ÁË¡£
¡¡¡¡×¢Ò⣺X WindowÓÉÓÚ»áͬʱ´ò¿ª¶à¸öÖն˴°¿Ú£¬Òò´Ë»áʹµÃÓû§µÇ¼Á¬½Óʱ¼äѸËÙÔö¼Ó¡£
¡¡¡¡lastlogÎļþ±£´æµÄÊÇÿ¸öÓû§µÄ×îºóÒ»´ÎµÇ¼ÐÅÏ¢£¬°üÀ¨µÇ¼ʱ¼äºÍµØµã£¬Õâ¸öÎļþÒ»°ãÖ»ÓÐlogin³Ì ÐòʹÓã¬Í¨¹ýÓû§µÄUID£¬À´ÔÚlastlogÎļþÖвéÕÒÏàÓ¦¼Ç¼£¬È»ºó±¨¸æÆä×îºóÒ»´ÎµÇ¼ʱ¼äºÍÖÕ¶Ëtty¡£È»ºó£¬ login³ÌÐò¾ÍʹÓÃеļǼ¸üÐÂÕâ¸öÎļþ¡£
¡¡¡¡ÕâÈý¸öÎļþÊÇʹÓöþ½øÖƸñʽ±£´æµÄ£¬Òò´Ë²»ÄÜÖ±½Ó²é¿´ÆäÖеÄÄÚÈÝ£¬¶øÐèҪʹÓÃÏà¹ØÃüÁî¡£µ±È»Ò²¿ÉÒÔͨ¹ý³ÌÐòÀ´ ·ÃÎÊÕâÈý¸öÎļþ£¬Õâ¾ÍÐèÒªÁ˽âËüÃÇʹÓõÄÊý¾Ý½á¹¹¡£ÆäÖÐutmpºÍwtmpʹÓÃͬÑùµÄÊý¾Ý½á¹¹£¬¶ølastlogʹÓà ÁíÍâÒ»¸öÊý¾Ý½á¹¹£¬¿ÉʹÓÃmanÀ´½øÐвéѯ¾ßÌå½á¹¹¡£Èç¹ûϵͳµÄÓû§ÊýÁ¿ºÜ¶à£¬ÄÇôwtmpÎļþµÄ´óС»áѸËÙÔö¼Ó£¬ÔÚ ÏµÍ³/varÎļþϵͳ¿Õ¼ä½ôÕŵÄÇé¿öÏ£¬¾Íµ¼ÖÂÕâ¸öÎļþϵͳ±»Õ¼Âú¡£ÏµÍ³²»»áÖ÷¶¯¿ØÖÆÕâ¸öÎļþµÄ´óС£¬Òò´ËÕâÐèÒª¹ÜÀí Ô±µÄ¸ÉÔ¤£¬ÐèÒªÊÖ¹¤¼°Ê±Çå³ý£¬»ò±àдshell½Å±¾¶¨ÆÚ±£´æºÍÇå³ý¡£
¡¡¡¡ÏµÍ³»¹¿ÉÒÔÌṩ¼ÇÕËͳ¼ÆµÄ¹¦ÄÜ£¬Òª´ò¿ªÏµÍ³µÄ¼ÆÕ˹¦ÄÜ£¬ÐèҪʹÓÃacctonÃüÁעÒ⣬accton±ØÐë¸ú Ëæ¼ÇÕËÈÕÖ¾ÎļþµÄÃû×Ö×÷²ÎÊý£¬¶ø²»´ø²ÎÊýµÄaccton½«¹Ø±Õ¼ÇÕ˽ø³Ì¡£
¡¡¡¡µ±´ò¿ªÁ˼ÇÕ˹¦Äܺ󣬿ÉÒÔʹÓÃlastcommÀ´¼ì²éÔÚϵͳÖÐÖ´ÐеÄËùÓÐÃüÁîµÄÐÅÏ¢£¬°üÀ¨Ö´ÐеÄÃüÁî¡¢Ö´ÐÐÃü ÁîµÄÓû§¡¢Óû§Ê¹ÓõÄÖÕ¶Ëtty£¬ÃüÁîÍê³ÉµÄʱ¼ä£¬Ö´ÐÐʱ¼äµÈ¡£´ÓlastcommµÄÊä³öÒ²ÄÜ°ïÖú¹ÜÀíÔ±¼ì²é¿ÉÄܵÄÈë ÇÖÐÐΪ¡£
¡¡¡¡´ËÍâ¿ÉÒÔʹÓÃacÃüÁîÀ´²éѯÓû§µÄÁ¬½Óʱ¼äµÄ±¨¸æ£¬saÃüÁîÀ´²éѯÓû§ÏûºÄµÄ´¦ÀíÆ÷ʱ¼äµÄ±¨¸æ¡£
¡¡¡¡SyslogÈÕÖ¾¼Ç¼
¡¡¡¡×î³õ£¬syslogÖ»ÊÇΪÁËsendmail¶øÉè¼ÆµÄÏûÏ¢ÈÕÖ¾¹¤¾ß£¬ÓÉÓÚËüÌṩÁËÒ»¸öÖÐÐÄ¿ØÖƵ㣬ʹµÃsys log·Ç³£ºÃÓúÍÒ×ÅäÖã¬Òò´Ëµ±½ñºÜ¶à³ÌÐò¶¼Ê¹ÓÃsyslogÀ´·¢ËÍËüÃǵļǼÐÅÏ¢¡£syslogÊÇÒ»ÖÖÇ¿´óµÄÈÕÖ¾¼Ç ¼·½Ê½£¬²»µ«¿ÉÒÔ½«ÈÕÖ¾±£´æÔÚ±¾µØÎļþÖУ¬»¹¿ÉÒÔ¸ù¾ÝÉèÖý«syslog¼Ç¼·¢Ë͵½ÍøÂçÉϵÄÁíһ̨Ö÷»úÖС£
¡¡¡¡Ö§³Ösyslog·½Ê½µÄϵͳÆô¶¯ÁËsyslogdÊØ»¤½ø³Ì£¬Õâ¸ö³ÌÐò´Ó±¾µØµÄUnixÌ×½Ó×ֺͼàÌýÔÚ514¶Ë ¿Ú£¨UDP£©ÉϵÄInternetÌ×½Ó×Ö£¬À´»ñµÃsyslogµÄ¼Ç¼¡£±¾»úÖнø³ÌʹÓÃsyslogϵͳµ÷Ó÷¢ËÍÀ´sy slog¼Ç¼£¬È»ºóÓÉsyslogd½«ËûÃDZ£´æµ½ÕýÈ·µÄÎļþ»ò·¢Ë͵½ÍøÂçÉÏÁíһ̨ÔËÐÐsyslogdÖ÷»úÖÐÈ¥¡£
¡¡¡¡ÏµÍ³»áʹÓÃnewsyslog¶¨ÆÚ¼ì²ésyslogÊä³öµÄmessagesÎļþºÍmaillogÎļþ£¬½«¾ÉÊý ¾ÝѹËõ±£´æΪ±¸·ÝÎļþ£¬Èçmessages.1.gzµÈ¡£
¡¡¡¡ÆäËûÈÕÖ¾
¡¡¡¡³ýÁËϵͳµÇ¼¼Ç¼ºÍsyslog¼Ç¼֮Í⣬ÆäËû»¹ÓÐһЩӦÓóÌÐòʹÓÃ×Ô¼ºµÄ¼Ç¼·½Ê½¡£
¡¡¡¡ÏµÍ³Ã¿Ì춼»á×Ô¶¯¼ì²éϵͳµÄ°²È«ÉèÖ㬰üÀ¨¶ÔSetUID¡¢SetGIDµÄÖ´ÐÐÎļþµÄ¼ì²é£¬Æä½á¹û½«Êä³öµ½/ var/log/security.todayÎļþÖУ¬¹ÜÀíÔ±¿ÉÒÔÓë/var/log/security.yeste rdayÎļþ¶Ô±È£¬Ñ°ÕÒϵͳ°²È«ÉèÖõı仯¡£
¡¡¡¡Èç¹ûϵͳʹÓÃsendmail£¬ÄÇôsendmail.stÎļþÖÐÒÔ¶þ½øÖÆÐÎʽ±£´æÁËsendmailµÄͳ¼Æ ÐÅÏ¢¡£
¡¡¡¡ÔÚϵͳÆô¶¯µÄʱºò£¬¾Í½«Äں˵ļì²âÐÅÏ¢Êä³öµ½ÆÁÄ»ÉÏ£¬ÕâЩÐÅÏ¢¿ÉÒÔ°ïÖúÓû§·ÖÎöϵͳÖеÄÓ²¼þ״̬¡£Ò»°ãʹÓÃd mesgÃüÁîÀ´²é¿´×îºóÒ»´ÎÆô¶¯Ê±Êä³öµÄÕâ¸ö¼ì²âÐÅÏ¢¡£Õâ¸öÐÅÏ¢Ò²±»ÏµÍ³±£´æÔÚ/var/log/dmesg.tod ayÎļþÖУ¬ÏµÍ³ÖÐͬʱҲ´æÔÚÁíÒ»¸öÎļþdmesg.yesterday£¬ÊÇÉϴεÄÆô¶¯¼ì²âÐÅÏ¢£¬¶Ô±ÈÕâÁ½¸öÎļþ£¬¾Í ¿ÉÒÔÁ˽⵽ϵͳӲ¼þºÍÄÚºËÅäÖõı仯¡£
¡¡¡¡lpd-errs¼Ç¼ÁËϵͳÖÐlpd²úÉúµÄ´íÎóÐÅÏ¢¡£
¡¡¡¡´ËÍ⣬¸÷ÖÖshell»¹»á¼Ç¼Óû§Ê¹ÓõÄÃüÁîÀúÊ·£¬ËüʹÓÃÓû§Ö÷Ŀ¼ÏµÄÎļþÀ´¼Ç¼ÕâЩÃüÁîÀúÊ·£¬Í¨³£Õâ¸öÎÄ ¼þµÄÃû×ÖΪ.history£¨csh£©£¬»ò.bash-historyµÈ¡£