个人工具

UbuntuHelp:RootSudoTimeout

来自Ubuntu中文

Wikibot讨论 | 贡献2009年5月18日 (一) 17:37的版本 (创建新页面为 '{{From|https://help.ubuntu.com/community/RootSudoTimeout}} {{Languages|UbuntuHelp:RootSudoTimeout}} By default sudo remembers your password for 15 minutes. If you want to change...')

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

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