How to change the default sudo timeout?

Windows Articles

How to compress large videos in Windows 10

Hello, how are you? Multimedia resources are definitely used in any system. Indeed, we live in the age of technology. That's why...

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...
angeloma
angeloma
Senior Writer and partner

Many times when working with sudo, we notice that it asks for a user password to execute the commands. However, after a while, if we want to use sudo again, we have to type it again. This is a security measure. Today I will show you how to change the default sudo timeout.

So, sudo program is part of the GNU suite. It is a small application that allows the execution of commands with the security privileges of another user. Normally, this “other” user is root.

Generally, Ubuntu-based distributions have sudo enabled. Although this is a security breach for many, it makes life much easier for newcomers.

On the other hand, the more server-oriented distributions like Debian, CentOS or RHEL do not even have it installed.

How to enable sudo on Debian 10?

However, sudo has a grace period. This is that after entering the password, there is a time when you can execute another command without entering the password again.

The previous situation implies a security breach. This has to be said. That’s why it’s possible to change that time to a shorter or a longer one.

Chaging the default sudo timeout

First, open a terminal session.

All sudo settings are stored in the /etc/sudoers file and need to be modified.

To do so, run the following command:

:~$ sudo nano /etc/sudoers

In this case I’m using a text editor called nano, but you can also use one with a graphical interface.

Once inside the file, you have to place the next line:

Defaults env_reset,timestamp_timeout=

However, in some Linux distributions that line does not exist, so you can add it at the end of the file and with the value in minutes you want. For example 1 for one minute.

In case you don’t want to be asked for the password anymore you can put the value one. Clearly this is not recommended at all.

Defaults env_reset,timestamp_timeout=1
1.- Change the default sudo timeout
1.- Change the default sudo timeout

Then save the changes and close the file.

And it’s done. Now after one minute, if you use another command with sudo, you will be asked for the password again.

Conclusion

Sudo is an unloved tool by many syadmin for being unsafe, but it is true that for a normal user of the system, it is a great advantage. Today you have learned how to modify the grace time it gives us without asking for the password.

Please share this post with your friends and join our Telegram channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to compress large videos in Windows 10

Hello, how are you? Multimedia resources are definitely used in any system. Indeed, we live in the age of technology. That's why...

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...
x