How to show password feedback in the Linux terminal
One of the most irritating things that new Linux users face when they start using the Linux command-line terminal is the lack of password feedback in the terminal. It can be very jarring to enter your password in the terminal only to see that no asterisks or symbols are indicating that your password has been entered.
For veteran Linux users, not having password feedback isn’t a big deal. Most people don’t think about it and move on. However, this lack of password feedback irritates new Linux users and needs to change.
Unfortunately, almost no major Linux operating systems enable password feedback in the terminal by default. As a result, Linux users must turn it on themselves. That’s why we’ve created this guide. We’ll show you how to enable password feedback in the Linux terminal.
Backing up your sudo configuration
Editing the sudo configuration on any Linux computer is very risky, and errors can happen. By following this guide, we’ll walk you through the process of editing your sudo configuration file in a way that things are safe. However, it is still a good idea to make a backup of your configuration.
To create a backup of your sudo configuration, start by opening up a terminal window on the Linux desktop. To open up a terminal window, press Ctrl + Alt + T orĀ Ctrl + Shift + T on the keyboard. Then, with the terminal window, move the terminal window to the /etc/
directory.
cd /etc/
Inside of the /etc/
directory, the sudoers file exists. This file handles sudo and all user permissions in relation to the ability to execute sudo commands. If you want to protect your sudo configuration, you will need to back up the sudoers file.
To create a backup of the sudoers file, make a copy of it with the cp command and rename it as sudoers.bak
. By renaming the sudoers file as sudoers.bak, you can keep a copy in the /etc/
directory, but keep it out of usage.
sudo cp sudoers sudoers.bak
After creating the backup, your sudoers file is protected. To take a look at the backup, you can run the cat command and view the contents of the backup.
cat /etc/sudoers
Running the cat command over the sudoers command will display the entire output of the file. However, you can also view it with the more command, which will give you more control.
sudo /etc/sudoers.bak | more
Enabling password feedback in the sudoers file
To enable password feedback in the sudoers file, we need to open it up for editing. But it is not advised to edit the sudoers file directly, as things can go wrong. Instead, Linux users looking to edit the sudoers file must use the visudo command. This command gives you direct access to everything in the sudoers file and will let you enable password feedback without messing up previous configurations, or anything like that.
To start the editing process, open up a terminal window. Then, use the sudo -s command to elevate your Linux terminal to root access. Root access is necessary for editing sudo permissions.
sudo -s
Once you’ve gotten root access, run the visudo command to access the configuration for the sudoers file. Be sure to add EDITOR=nano to the front of it, or you may be forced to use another more confusing editor.
EDITOR=nano visudo
Once inside of the Nano text editor, locate the line of text below in the sudoers file.
Defaults env_reset
Change the look of the line from how it looks above to the line of text below. Adding this line of text will enable the password feedback feature for any user on your Linux PC that has access to the sudo command.
Defaults env_reset,pwfeedback
After adding the new line to the sudoers file, press the Ctrl + O button on the keyboard to save your edits. Then, press the Ctrl + X command to exit the Nano text editor and close the visudo command.
Disable password feedback
So you’ve enabled password feedback for the sudo command on your Linux PC, and as it turns out, you don’t like it. Here’s how to change it back. First, open up a terminal window and use the CD command to move into the /etc/
directory.
cd /etc/
Inside of the /etc/ directory, elevate your account to the root account using the sudo -s command.
sudo -s
Now that the terminal has root access, use the rm command to delete the current sudoers file.
rm sudoers
Finally, restore the backup sudoers file.
mv sudoers.bak sudoers
When the backup is restored, password feedback should be shut off. If password feedback is still enabled, use the visudo command to manually shut it off.
Use visudo instead of modifying /etc/sudoers directly. Otherwise, you risk breaking sudo and being unable to fix it.
Nice!
Great content recently on Addictivetips.
Thanks for the compliments Zvi.