tencent cloud

Feedback

Getting Instance Login Logs

Last updated: 2022-07-07 11:27:10

    Overview

    This document describes how to obtain user login records of a CVM instance.

    Directions

    Note

    This document uses a Linux instance on TencentOS Server 3.1 (TK4) as an example. As the steps may vary by operating system, proceed based on the actual conditions.

    1. Log in to the Linux instance by using Web Shell.
    2. You can view the following user login information as needed:
      Note

      User login logs are usually stored in the /var/run/utmp, /var/log/wtmp, /var/log/btmp, and /var/log/lastlog files.

    • Run the who command to view the information of the currently logged-in user in the /var/run/utmp file. The returned result is as follows:
    • Run the w command to view the username of the currently logged-in user and display the currently executed tasks of the user in the /var/run/utmp file. The returned result is as follows:
    • Run the users command to view the username of the currently logged-in user in the /var/run/utmp file. The returned result is as follows:
    • Run the last command to view the information of the currently and historically logged-in users in the /var/log/wtmp file. The returned result is as follows:
    • Run the lastb command to view the information of all the users who failed to log in to the system in the /var/log/btmp file. The returned result is as follows:
    • Run the lastlog command to view the last user login information in the /var/log/lastlog file. The returned result is as follows:
    • Run the cat /var/log/secure command to view the login information. The returned result is as follows:
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support