From 996d0eb921e9963d603a955cc09dee5054616b73 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 19 Jan 2017 11:57:20 +0800 Subject: [PATCH] translated --- ... Password Timeout Session Longer in Linux.md | 63 ------------------- ... Password Timeout Session Longer in Linux.md | 61 ++++++++++++++++++ 2 files changed, 61 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md create mode 100644 translated/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md diff --git a/sources/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md b/sources/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md deleted file mode 100644 index 0c1af73248..0000000000 --- a/sources/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md +++ /dev/null @@ -1,63 +0,0 @@ -translating---geekpi - -How to Keep ‘sudo’ Password Timeout Session Longer in Linux -============================================================ - -In recent articles, we’ve showed you [10 Useful Sudoers Configurations in Linux][1] and [Let Sudo Insult You When You Enter Incorrect Password][2], and in this article, we discovered a another sudo tip that will help you to make sudo password sessions (timeout) longer or shorter in Ubuntu Linux. - -In Ubuntu and its derivatives such as Linux Mint or any other Ubuntu-based distro, when you execute a [sudo command][3], it will prompt you to enter administrative password. - -After you execute sudo command first time, the password will last for 15 minutes by default, so you don’t need to type password for every sudo command. - -If, somehow you feel that the 15 minutes too long or short for some reason, you can change it with a easy tweak in sudoers file. - -To set the sudo password timeout value, use the `passwd_timeout` parameter. First open the /etc/sudoers file with super user privileges using sudo and visudo commands like so: - -``` -$ sudo visudo -``` - -Then add the following defaults entry, it implies that the sudo password prompt will time out after 20 minutes once sudo is invoked by a user. - -``` -Defaults env_reset,timestamp_timeout=20 -``` - -Note: You can set whatever time you want in minutes and make sure to wait before it times out. You can also set time to `0` if you want a password prompt for every sudo command you execute, or disable password prompt forever by setting the value `-1`. - -The screen shot below show the defaults parameters I have set in my /ec/sudoers file. - -[ - ![Change sudo Password Timeout](http://www.tecmint.com/wp-content/uploads/2017/01/set-sudo-password-timeout-session.png) -][4] - -Change sudo Password Timeout - -Save the file by pressing `[Ctrl + O]` and exit using `[Ctrl + X]`. Afterwards test if the setting is working by running a command with sudo and wait for 2 minutes to see if the password prompt will time out. - -In this post, we explained how to set the number of minutes before the sudo password prompt times out, remember to share your thoughts concerning this article or perhaps other [useful sudeors configurations for system administrators][5] out there via the feedback section below. - --------------------------------------------------------------------------------- - -作者简介: - -![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g) - -Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge. - - - -via: http://www.tecmint.com/set-sudo-password-timeout-session-longer-linux/ - -作者:[Aaron Kili ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/aaronkili/ -[1]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ -[2]:http://www.tecmint.com/sudo-insult-when-enter-wrong-password/ -[3]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/ -[4]:http://www.tecmint.com/wp-content/uploads/2017/01/set-sudo-password-timeout-session.png -[5]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ diff --git a/translated/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md b/translated/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md new file mode 100644 index 0000000000..2c6ad2b08e --- /dev/null +++ b/translated/tech/20170118 How to Keep ‘sudo’ Password Timeout Session Longer in Linux.md @@ -0,0 +1,61 @@ +如何在 Linux 让 ‘sudo’ 密码会话超时更长些 +============================================================ + +在最近的文章中,我们向你展示了[ Linux 中的 10 个有用的 sudoers 配置][1]以及[让 sudo 在输入不正确的密码时冒犯你][2],在本文中,我们发现了另一个 sudo 贴士,在 Ubuntu Linux 中使 sudo 密码会话(超时)更长或更短。 + +在 Ubuntu 及其衍生版如 Linux Mint 或任何其他基于 Ubuntu 的发行版中,当你执行 [sudo command][3] 时,它将提示你输入管理密码。 + +在第一次执行 sudo 命令后,默认情况下密码将保持 15 分钟,因此你不需要为每个 sudo 命令键入密码。 + +如果,你因为某种原因觉得 15 分钟太长或太短,你可以在 sudoers 文件中做一个简单的调整。 + +要设置 sudo 密码超时值,请使用 `passwd_timeout` 参数。首先使用 sudo 和 visudo 命令以超级用户权限打开 /etc/sudoers 文件,如下所示: + +``` +$ sudo visudo +``` + +接着添加下面的默认值,这意味着 sudo 密码提示将会在用户使用 sudo 20 分钟后过期。 + +``` +Defaults env_reset,timestamp_timeout=20 +``` + +注意:你可以马上设置任何所需的时间,并确保在超时之前等待。 如果要为每个执行的 sudo 命令弹出密码提示,你也可以将时间设置为0,或者通过设置值 `-1` 永久禁用密码提示。 + +下面的截图显示了我在 /etc/sudoers 文件中设置的默认参数。 + +[ + ![Change sudo Password Timeout](http://www.tecmint.com/wp-content/uploads/2017/01/set-sudo-password-timeout-session.png) +][4] + +改变 sudo 密码超时 + +按 `[Ctrl + O]` 保存文件,然后使用 `[Ctrl + X]` 退出。 然后,使用 sudo 运行命令并等待 2 分钟以检查密码提示是否超时以测试设置是否正常。 + +在本篇中,我们解释了如何设置 sudo 密码提示超时之前的分钟数,记得在评论栏分享你对这篇文章的想法或者其他[对系统管理员配置有用的 sudo 配置][5]。 + +-------------------------------------------------------------------------------- + +作者简介: + +![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g) + +Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin 以及 web 开发人员,目前是 TecMint 的内容创建者,他喜欢用电脑工作,并坚信分享知识。 + + + +via: http://www.tecmint.com/set-sudo-password-timeout-session-longer-linux/ + +作者:[Aaron Kili ][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ +[1]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[2]:http://www.tecmint.com/sudo-insult-when-enter-wrong-password/ +[3]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/ +[4]:http://www.tecmint.com/wp-content/uploads/2017/01/set-sudo-password-timeout-session.png +[5]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/