UbuntuHelp:RootSudoTimeout
来自Ubuntu中文
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
By default sudo remembers your password for 15 minutes. If you want to change that you can do so by
sudo visudo
This opens the vi editor (by default) and points it to the sudoers file. You're now a super user editing one of the most important files on your system. No stress! Vi instructions: Vi is modeful editor and a bit klunky to use. Use the arrow keys to move to the end of the Defaults line. Then press they A (capital "a") key to move at the end of the current line and enter editing mode (append after the last character on the line). In Ubuntu, visudo opens nano. Now type
,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 Then hit Escape to return to command mode. Now, if you're happy with your editing, type in :w <ENTER> to write the file and :q <ENTER> to exit vi. If you made a mistake, perhaps the easiest way is to redo from start, to exit without saving (hit Escape to enter the command mode) and then type :q! <ENTER>. You might want to read the sudoers and vi manual pages for additional information.
man sudoers
man vi