linux终端窗口
When you run a command using sudo in Linux, the Terminal prompts you to type in your password with no visual feedback as you type. We’ll show a quick tweak that will show asterisks (*) when you type in your password in the Terminal.
在Linux中使用sudo运行命令时,终端会提示您键入密码,并且键入时不会产生视觉反馈。 我们将显示一个快速调整,当您在终端中输入密码时,该调整将显示星号(*)。
NOTE: When we say to type something in this article and there are quotes around the text, DO NOT type the quotes, unless we specify otherwise.
注意:当我们说要在本文中键入某些内容并且文本周围有引号时,请不要键入引号,除非我们另外指定。
We will open the “/etc/sudoers” file and change a setting to customize the length of the grace period. To begin, press Ctrl + Alt + T to open a Terminal window. Type the following command at the prompt and press Enter.
我们将打开“ / etc / sudoers”文件并更改设置以自定义宽限期的长度。 首先,请按Ctrl + Alt + T打开“终端”窗口。 在提示符下键入以下命令,然后按Enter。
sudo visudo
苏多维苏多
Type your password when prompted and press Enter. Notice that no asterisks are displayed when you enter your password.
出现提示时输入密码,然后按Enter。 请注意,输入密码时不会显示星号。
A file opens directly in the Terminal window using the Nano text editor. Use the arrow keys on your keyboard to move the cursor to the end of the following line:
使用Nano文本编辑器直接在“终端”窗口中打开一个文件。 使用键盘上的箭头键将光标移至以下行的末尾:
Defaults env_reset
默认值env_reset
IMPORTANT: Never edit the sudoers file with a normal text editor. Always use the visudo command as described here. If the sudoers file has improper syntax, you will be left with a system where it’s impossible to obtain elevated or root privileges. The visudo command opens a text editor like you would with normal text files, but the command also validates the syntax of the file upon saving it. This prevents configuration errors in the sudoers file from blocking sudo operations, which could be your only method of obtaining root privileges.
重要说明:切勿使用常规文本编辑器编辑sudoers文件。 始终按此处所述使用visudo命令。 如果sudoers文件的语法不正确,您将获得无法获得提升特权或root特权的系统。 visudo命令像打开普通文本文件一样打开文本编辑器,但是该命令还会在保存文件时验证文件的语法。 这样可以防止sudoers文件中的配置错误阻止sudo操作,这可能是获取root特权的唯一方法。
Traditionally, Linux uses vi as the default editor, but Ubuntu has chosen to use Nano. If you would rather use vi as the default text editor in Ubuntu, rather than Nano, see our article.
传统上,Linux使用vi作为默认编辑器,但是Ubuntu选择使用Nano。 如果您希望使用vi作为Ubuntu中的默认文本编辑器,而不是Nano,请参阅我们的文章 。
Change the line by adding “,pwfeedback” to the end of the line.
通过在行末添加“,pwfeedback”来更改行。
Defaults env_reset,pwfeedback
默认值env_reset,pwfeedback
You can also press Enter after “env_reset” to make a new line and type the following on the new line:
您也可以在“ env_reset”之后按Enter换行,并在新行中键入以下内容:
Defaults pwfeedback
默认为pwfeedback
NOTE: The space between “Defaults” and “pwfeedback” should be a tab.
注意:“默认值”和“ pwfeedback”之间的空格应为制表符。
Once you have made the change, press Ctrl + X and type a “y” in response to the question that displays at the bottom of the window to save your changes.
进行更改后,按Ctrl + X并键入“ y”,以回答显示在窗口底部的问题以保存更改。
You will be asked for the File Name to Write at the bottom. Press Enter to accept the default.
在底部将要求您输入要写入的文件名。 按Enter接受默认值。
You are returned to the command prompt. To close the Terminal window, type “exit” at the prompt and press Enter. You can also click the X button in the upper-left corner of the window.
您将返回到命令提示符。 要关闭“终端”窗口,请在提示符下键入“ exit”,然后按Enter。 您也可以单击窗口左上角的X按钮。
The next time you open a Terminal window and run a command using sudo, you will see asterisks when entering your password at the prompt.
下次打开“终端”窗口并使用sudo运行命令时,在提示符下输入密码时会看到星号。
NOTE: You must close the Terminal window and open it for the change to take place.
注意:您必须关闭并打开终端窗口以进行更改。
linux终端窗口