--Originally published at TC2027 – Blog will Tear us Apart
So, you’ve been playing with your Ubuntu distribution around, and suddenly you require sudo privileges in order to change or install a special feature. Thus, you enter your password and grant that privilege access to your computer.
I believe I don’t have to remind you that being logged as root is dangerous and you should only run commands and programs as root when you’re 100% sure of what you’re doing. In the default terminal, after you enter the password once, it allows you to run the next commands with the root privileges without password prompt.
On my Linux experience I have typed commands that weren’t mean to be on root access or finding someone (my hacker girlfriend) accessing my root folders without having to input any password.
After digging around I found a, surprisingly easy, way to modify the default sudo settings in order to change the timeout of the root access.
Let us access the configuration file.
This command is absolutely necessary in order to modify the file, even on the file it says so:
#This file MUST be edited with the 'visudo' command as root.
Don’t worry, the editor is not vim, it opens it with nano. Almost at the beginning of the file one can see preformed default variables, the one that matters to us is the following:
This is where we can modify the value of timeout, notice that the variable is not even defined at the file. On the same line, we need to append the timeout variable with the following syntax:
Now, instead of the x we can add any integer value. This value represent the time in seconds that the terminal will wait before asking for the password again.
If you want the computer to ask for the password
And, that’s it, remember to ctrl+O to write it out, and ctrl+x to exit the editor.