Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display an asterisk when entering a password in a linux terminal

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to display an asterisk when entering a password in a linux terminal. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

When you enter a password in a Web browser or any GUI login, the password will be marked with an asterisk * or a dot. This is a built-in security mechanism to prevent users near you from seeing your password. But when you enter a password on the terminal to perform any sudo or su administrative tasks, you will not see an asterisk or dot when entering the password. It will not have any visual indication of entering a password, nor will there be any cursor movement, nothing. You don't know if you typed all the characters. You will only see a blank screen!

Look at the screenshot below.

As you can see in the picture above, I have entered the password without any instructions (asterisks or dots). Now, I'm not sure if I've entered all the passwords. This security mechanism can also prevent people near you from guessing the length of the password. Of course, this behavior can be changed. This is what this guide is about. It's not difficult. Please continue to read.

Display an asterisk when you enter a password at the terminal

To display an asterisk when entering a password on the terminal, we need to make some minor changes in / etc/sudoers. Back up this file before making any changes. To do this, simply run:

Sudo cp / etc/sudoers {, .bak}

The above command backs up / etc/sudoers as / etc/sudoers.bak. You can restore it in case you make a mistake after editing the file.

Next, edit / etc/sudoers using the following command:

Sudo visudo

Find the following line:

Defaults env_reset

Add an extra word, pwfeedback, at the end of the line, as shown below.

Defaults env_reset,pwfeedback

Then, press CTRL + x and y to save and close the file. Restart the terminal for the changes to take effect.

Now, when you enter your password on the terminal, you will see an asterisk.

This tip can be helpful if you feel uncomfortable that you can't see the password when entering the password on the terminal. Please note that when you enter your password, other users can predict the length of your password. If you don't mind, please follow the above method to make your password visible (shown as an asterisk, of course! ).

This is the end of the article on "how to display an asterisk when entering a password in a linux terminal". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report