Merge pull request #3 from LCTT/master

merge commits
This commit is contained in:
mudongliang 2016-02-21 15:09:53 +08:00
commit 9402e48030
2 changed files with 58 additions and 59 deletions

View File

@ -1,59 +0,0 @@
Translating---geekpi
Make Sudo Insult User For Each Incorrect Password Attempt
===========================================================
You can have lots of fun in Linux terminal. And I am not talking about those funny commands to [run a train in Linux terminal](http://itsfoss.com/ubuntu-terminal-train/).
I am talking about little tweaks in the terminal that will lighten up your mood. In a previous article, you learnt [how to increase sudo timeout in Linux terminal](http://itsfoss.com/change-sudo-password-timeout-ubuntu/). In todays fun post, Ill show you how you can make sudo to insult you (or other users) when incorrect password is attempted with sudo command.
Confused what I am talking about? Here, take a look at this gif to get a gist of how sudo can insult you for typing in the incorrect password.
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux.gif)
Now, why would you do that and take insults? After all, insults are not going to brighten up your day, is it?
To me, this little tweak is funny and is better than the plain old “incorrect password” error message. Moreover, I can show it off to my friends (in this case you, via Its FOSS) to amuse them. I am pretty sure you can come up with your own reason to use this tweak.
## Enable insults in sudo
You can enable insults in `sudo` by adding the following line in `sudo` configuration:
```
Defaults insults
```
Lets see how to do that. Open a terminal and use the following command:
```
sudo visudo
```
This should open the configuration file in [nano](http://www.nano-editor.org/). Yeah, I know that traditionally visudo should open the `/etc/sudoers` file in Vi editor, but Ubuntu and Ubuntu based Linux distribution will open it in nano. Since we are talking about Vi, here is a [cheat sheet for Vi editor](http://itsfoss.com/download-vi-cheat-sheet/) that could come handy if you decide to use Vi.
Coming back to editing the sudeors file, you need to find the section where Defaults are listed. Luckily, it is in the beginning itself. Just add “Defaults insults” line to it, like this:
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint.png)
If you are using nano, use `Ctrl+X` to quit the editor. At the time of quitting, it will ask you if you want to save the changes or not. To save the changes, press `Y`.
Once you have saved the changes in sudoers file, open a terminal and use any command with sudo. Deliberately type wrong password and enjoy the abuses :)
sudo could be nasty. See, it even threatens me of consequences if I type incorrect password again. LOL.
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint-1.jpeg)
If you like this terminal hack, check out other [terminal tricks](http://itsfoss.com/category/terminal-tricks/) posts as well. If you have other such fun tweaks and hacks, do share it in the comment box below.
------------------------------------------------------------------------------
via: http://itsfoss.com/sudo-insult-linux/
作者:[ABHISHEK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/

View File

@ -0,0 +1,58 @@
让sudo在用户输错密码时侮辱用户
===========================================================
你在Linux终端中会有很多的乐趣。我今天要讲的不是在[终端中跑火车](http://itsfoss.com/ubuntu-terminal-train/)。
我今天要讲的技巧可以放松你的心情。前面一篇文章中,你学习了[如何在命令行中增加sudo命令的超时](http://itsfoss.com/change-sudo-password-timeout-ubuntu/)。今天的文章中我会向你展示如让sudo在输错密码的时候侮辱你或者其他人
对我讲的感到疑惑这里让我们看下这张gif来了解sudo如何在你输错密码之后侮辱你的。
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux.gif)
现在,你为什要这么做?毕竟,侮辱不会让你的一天开心,不是么?
对我来说,一点小技巧都是有趣的,并且要比以前的“密码错误”的错误提示更有趣。另外,我可以向我的朋友展示娱乐(这个例子中是通过自由开源软件)。我很肯定你有你自己的里有来使用这个技巧的。
## 在sudo中启用侮辱
你可以在`sudo`配置中增加下面的行来启用侮辱功能:
```
Defaults insults
```
让我们看看该如何做。打开终端并使用下面的命令:
```
sudo visudo
```
这会在[nano](http://www.nano-editor.org/)中打开配置文件。使得我知道传统的visudo应该在vi中打开`/etc/sudoers` 文件但是Ubuntu及基于它的发行版会使用nano打开。由于我们再讨论vi这里有一份[vi速查表](http://itsfoss.com/download-vi-cheat-sheet)可以在你决定使用vi的时候使用。
回到编辑sudeors文件界面你需要找出Defaults所在的行。幸运的是只需要在文件的开头加上“Defaults insults”就像这样
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint.png)
如果你正在使用nano使用`Ctrl+X`来退出编辑器。在退出的时候它会询问你是否保存更改。要保存更改按下“Y”。
一旦你保存了sudoers文件之后打开终端并在任何命令中使用sudo。故意输错密码病享受辱骂
sudo可能会讨厌的。看见没他甚至在我再次输错之后威胁我。哈哈
![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint-1.jpeg)
如果你喜欢这个终端技巧,你也可以查看[其他终端技巧的文章](http://itsfoss.com/category/terminal-tricks/)。如果你有其他有趣的技巧,在评论中分享。
------------------------------------------------------------------------------
via: http://itsfoss.com/sudo-insult-linux/
作者:[ABHISHEK][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/