Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make the timeout of sudo password session longer in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to make the sudo password session timeout longer in Linux, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.

In Ubuntu and its derivatives such as Linux Mint or any other Ubuntu-based distribution, when you execute the sudo command, it will prompt you for an administrative password.

By default, the password will remain for 15 minutes after the sudo command is executed *, so you don't need to type a password for each sudo command.

If, for some reason, you think 15 minutes is too long or too short, you can make a simple adjustment in the sudoers file.

To set the sudo password timeout value, use the passwd_timeout parameter. First open the / etc/sudoers file with root privileges using the sudo and visudo commands, as follows:

$sudo visudo

Then add the following default value, which means that the sudo password prompt will expire 20 minutes after the user uses sudo.

Defaults env_reset,timestamp_timeout=20

Note: you can set the minutes to any time you need, and it will wait until it times out. If you want to pop up the password prompt for each sudo command executed, you can also set the time to 0 or disable the password prompt by setting the value-1 *.

The screenshot below shows the default parameters I set in the / etc/sudoers file.

Timeout for changing sudo password

Press Ctrl + O to save the file, and then use Ctrl + X to exit. Then, use sudo to run the command and wait 2 minutes to check if the password prompt timed out to test that the settings are normal.

The above is all the contents of the article "how to make the sudo password session timeout longer in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report