Ubuntu:在 bash 命令后退出 sudo?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3771411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu: exit sudo after a bash command?
提问by the wolf
I have Ubuntu 10.04. Certain operations in the Terminal application or operations require me to type sudo [whatever command]and my password. I have noticed the effects of sudolast for awhile; five minutes or so.
我有 Ubuntu 10.04。终端应用程序中的某些操作或操作需要我输入sudo [whatever command]密码。我已经注意到sudolast 一段时间的效果了;五分钟左右。
How can I explicitly exit sudoand go back to being me at the command prompt?
如何sudo在命令提示符下明确退出并返回到我自己?
回答by Andrew Aylett
sudo -k
Note that you're not running sudoto need to exit it, rather sudo remembers the last time you authenticated and doesn't require re-authentication if that's recent enough. This command will reset timestamp to the epoch. You can change the timeout value in the system configuration file: man sudoers.
请注意,您sudo不需要退出它,而是 sudo 会记住您上次进行身份验证的时间,并且如果足够新,则不需要重新进行身份验证。此命令将时间戳重置为纪元。您可以在系统配置文件中更改超时值:man sudoers.

