- Product Bulletin
- Service Overview
-
User Guide
- Usage Overview
- Selecting HCE as the Public Image When Creating an ECS
- Changing an OS to HCE
- Migrating an OS
- Upgrading HCE and RPM Packages
- Security Updates for HCE
- Obtaining the openEuler Extended Software Packages
- Creating a Docker Image and Starting a Container
- Tools
- Kernel Functions and Interfaces
- xGPU
- Configuring the Repositories and Installing Software for HCE
-
FAQs
- What Do I Do If CentOS Linux Is No Longer Maintained?
- Does Huawei Cloud Have a Migration Solution for CentOS?
- How Do I Install the MLNX Driver?
- How Do I Enable SELinux on an ECS Running HCE?
- How Do I Change the OS Name on the Console After the OS Is Migrated?
- How Are Huawei Cloud EulerOS, EulerOS, and openEuler Different from One Another?
- How Do I Enable WireGuard in Kernel and Install wireguard-tools?
- How Do I Save the User Credential Information for Logging In to Docker Like What Docker CE Does?
- What Is OOM? Why Does OOM Occur?
- How Do I Handle IPVS Errors?
- Why Can't HCE Obtain an IPv6 Address After IPv6 Is Enabled for an ECS?
- How Do I Set Auto Log Using TMOUT?
- Best Practices
- General Reference
Copied.
How Do I Set Auto Log Using TMOUT?
Scenarios
To ensure system security and reduce resource waste, users must log out they are not actively using the system. This can be achieved by setting an automatic logout timer using TMOUT.
TMOUT is an environment variable in Linux shell that defines number of seconds a shell session can be idle before it is automatically logged out. When this variable is set, shell will terminate session if there is no input activity for set time. If this variable is not set or is set to 0, automatic logout is disabled, and users are not disconnected due to long-time inactivity.
Procedure
- Check the automatic logout time (the value of TMOUT):
echo $TMOUT
If no value is returned, TMOUT is not configured.
- Configure the automatic logout time for the current session. To define a long-term automatic logout time, go to 3.
export TMOUT=seconds
- Use this variable to set a long-time automatic logout time.
Run the following command to modify the /etc/profile file. If the modification does not take effect, modify the /etc/bashrc file. The modification steps are the same. In this way, the automatic logout time will be configured for all users who use the configuration file.
vim /etc/profile
Or
vim /etc/bashrc
Add the following command to the end of the file: For example, you can set the automatic logout time to 1,200 seconds. If the value is set to 0, the automatic logout is disabled.
export TMOUT=1200
Save and then refresh the file.
source /etc/profile
Method 2
Run the following commands in sequence to change the automatic logout time:
sed -i '$a\export TMOUT=1200' /etc/profile source /etc/profile
- Check the automatic logout time:
echo $TMOUT
If the defined value is displayed, the automatic logout is configured successfully.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot