In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Method 1: implement it by modifying the .bashrc or .bash _ profile file
This is done by modifying the .bashrc or .bash _ profile file in the home directory. Select one of the two files to add the following line at the end, as follows:
[GeekDevOps@GeekDevOps /] $cd ~ [GeekDevOps@GeekDevOps ~] $echo "TMOUT=90" > > .bashrc [GeekDevOps@GeekDevOps ~] $source .bashrc
We chose the .bashrc file in the above code, and if you choose .bash _ profile, it's the same procedure. Above, we set the automatic logout time for users to 90 seconds. After 90 seconds, the screen displays as follows:
[GeekDevOps@GeekDevOps ~] $timeout waiting for input: automatically logs out of Connection closing...Socket close.Connection closed by foreign host.Disconnected from remote host (10.1.1.21 at 22) at at 16:38:48.
Method 2: implement by modifying the configuration file of ssh
Ssh is a tool we often use in Linux systems. We can also log out automatically after timeout by modifying the configuration file / etc/ssh/sshd_config of ssh, as shown below:
[root@GeekDevOps ~] # vim / etc/ssh/sshd_config
Find the following two lines:
# ClientAliveInterval 90#ClientAliveCountMax 3
Remove the comments and modify the following numbers:
ClientAliveInterval 60ClientAliveCountMax 5
After saving and exiting, restart the ssh service:
[root@GeekDevOps ~] # service sshd restart
This method has a 60-second login timeout for all users except root and automatically logs out. The first line indicates that it is detected every 90 seconds, and the second line indicates that the connection is disconnected after five inactivity is detected.
Method 3: implement by modifying the configuration file of ssh
In the / etc/profile file, add the TMOUT field, and then source / etc/profile.
TMOUT=300export TOMOUT
Method 4: create a script
Log in as the root user and create a new file called autologout.sh.
Vim / etc/profile.d/autologout.sh
Add the following:
TMOUT=100readonly TMOUTexport TMOUT
Save and exit the file and add executable permissions to it:
Chmod + x / etc/profile.d/autologout.sh
Now, log out or restart the system. Inactive users will automatically log out after 100 seconds. Ordinary users cannot modify the configuration even if they want to keep the session connection, and they will be forced to exit after 100 seconds.
Summary
The above is the editor introduced to you under the Linux to achieve inactive users login timeout after automatic logout, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.