Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to change sudo timeout, so I edit sudoers via visudo (as adviced in many tutorials online) to the following form:

Defaults env_reset , timestamp_timeout=20
root    ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
%sudo   ALL=(ALL:ALL) ALL
Defaults:my_username timestamp_timeout=10

the problem is, that nothing works and it seems I have sudo timeout=0. This is my output from uname -a:

Linux comp 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

UPDATE

What I've noticed it's only happens when I use fish (aka user friendly shell). So problem probably with fish itself not with sudoers file.

SOLUTION The problem was with my shell fish aka user friendly (not very friendly this time, isn't it?) shell. For some reason it seemed that sudo command each time went from different sessions. Adding Defaults !tty_tickets in sudoers file (as described http://us.generation-nt.com/answer/bug-598567-sudo-requires-reauthentication-each-use-ignoring-time-stamp-help-200510161.html ) solved the problem. See the link above for the addition information.

Thank you all for your attention without it I could not figure the thing out.

share|improve this question

5 Answers 5

up vote 6 down vote accepted

The problem was with my shell fish aka user friendly (not very friendly this time, isn't it?) shell. For some reason it seemed that sudo command each time went from different sessions. Adding

Defaults !tty_tickets

in sudoers file (as described http://us.generation-nt.com/answer/bug-598567-sudo-requires-reauthentication-each-use-ignoring-time-stamp-help-200510161.html ) solved the problem. See the link above for the addition information.

Thank you all for your attention without it I could not figure the thing out.

share|improve this answer
3  
Thanks, this actually works! –  U2744 SNOWFLAKE Oct 5 '12 at 2:15
    
Thanks - this helped me on Raspbian right now. Many thanks! :) –  Per Lundberg Jul 13 at 19:00

This way sudo will never ever ask you for password

as the default user is member of admin group , my user name is "one"

id one
uid=1000(one) gid=1000(one) groups=1000(one),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare),125(debian-tor)

sudo visudo & add the NOPASSWD %admin

Members of the admin group may gain root privileges
%admin ALL=(ALL)NOPASSWD: ALL

Then press “ctrl+x” and then press “y” and to finish press enter.

share|improve this answer
    
This is probably not a really good idea, security-wise, so I think it should be advised against. It's better to make the timeout high enough (like 1 hour or even multiple hours) than disabling the password altogether. –  Per Lundberg Jul 13 at 19:01

By default sudo remembers your password for 15 minutes. If you want to change that you can do so by

sudo visudo

timestamp_timeout=X

where X is the timeout expiration in minutes. If you specify 0 you will always be asked the password. If you specify a negative value, the timeout will never expire. E.g. Defaults env_reset,timestamp_timeout=5

                                                                                    RootSudoTimeout

share|improve this answer

                                                                                      Change sudo timeout

sudo visudo

A text document will open up in the terminal.Navigate to the bottom of the document using your arrows on your keyboard.

Defaults timestamp_timeout=-1

Then press “ctrl+x” and then press “y” and to finish press enter.

                                                   NOTE

If you put a “-1″ value, you’ll have an unlimited sudo timeout. This isn’t very wise to do for normal users.

Increasing the value to 10, will give you a 10 minutes sudo timeout.

share|improve this answer
    
The catch is that by default in my fresh install of ubuntu is not timeout: i have to type sudo password every time even seconds after I've already typed it! –  Moonwalker Feb 22 '12 at 5:18
    
you dont want to type password ? am i right –  One Zero Feb 22 '12 at 5:20
    
webupd8.org/2010/04/… –  One Zero Feb 22 '12 at 5:30
    
I just dont want to type password everytime. But now It seems it's because of bug in my shell: us.generation-nt.com/answer/… I will try to turn of tty_tickets whatever they are and see whether it works. –  Moonwalker Feb 22 '12 at 5:35
1  
@Moonwalker see my New 3rd asnwer % admin one , this will never ever ask you for password –  One Zero Feb 22 '12 at 5:38

I'm wondering if the space around the , mark is your problem. I've not seen a sudoers file working with that type of syntax. Perhaps try removing the space before and after the , in the sudoers file and see if that doesn't help.

You could also try a user specific setting of Defaults:moonwalker timestamp_timeout=20 to apply it to just your user account allowing you to skip that line and any potential syntax issues with it.

share|improve this answer
    
I've tried both to remove space around , and adding the line as you suggested but nothing works. I think that my problem is actually deeper than wrong syntax of sudoers file: in the fresh install default sudo timeout should be ten minutes but in my case there it requires to type password for sudo each time even seconds after previous time :( –  Moonwalker Feb 22 '12 at 5:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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