0

How can one use sudo, without typing sudo more than once per sudo session?

By that I mean that you'll be asked to type your password each 15 minutes after the last command you executed, while executing commands within this time (within this "grace period") will restart the timeout.

Another example:

  1. You boot the system.
  2. You execute any command whatsoever.
  3. Immediately after that, you are being asked to fill in your password.
  4. The command is executed.
  5. If 15 minutes passed and you haven't typed any command (say, you suddenly had to leave the PC), you will be prompted for your password again.

This could save typing the word sudo instead typing it tens if not hundreds of times a day (not always you run scripts as sudo).

  • This is how sudo works by default, isn't it? – Andrea Corbellini Aug 13 '17 at 4:47
  • Up until this moment I thought one should type "sudo" before each command within the "grace period". – JohnDoea Aug 13 '17 at 4:48
  • Oh, yes, I misunderstood: you still need to type "sudo" before each command. You might want to open a root shell then: sudo -i -- from there, each command you execute is ran as root – Andrea Corbellini Aug 13 '17 at 4:50
  • If it implements the grace period concept it's good. – JohnDoea Aug 13 '17 at 4:55
1

Use sudo -i. The -i option will log you in and you won't have to retype the password or add sudo before commands every single time.

  • Is this su mode? Because I don't the regular su mode. – JohnDoea Aug 13 '17 at 7:54
  • No, this is not su mode. sudo -i simply logs you in with your(current user's) password and gives you root privileges. – Gokul Aug 15 '17 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.