Announcement

Collapse
No announcement yet.

Show feedback when typing password using sudo

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Show feedback when typing password using sudo

    How to Show Asterisks While Typing Sudo Password in Linux

    by Ravi Saive | Published: January 15, 2018 | January 15, 2018

    ***NOTE*** Text below of original post edited, substituting apt in place of yum to better reflect what a Kubuntu user might do and see if making this change. Additionally, the instructions on how to save a file when using nano editor were corrected.

    Most applications normally display a feedback using asterisks(*******) when a user is typing a password, but on the Linux terminal, when a normal user runs the sudo command to gain super user privileges, he/she is asked for a password, but no visual feedback is seen by the user while typing the password.
    In this article, we will show how to display asterisks as feedback when you type passwords in the terminal in Linux.

    Take a look at the following screen shot, here the user tecmint has invoked the sudo command to install the vim text editor in CentOS 7, but there is no visual feedback as the password is typed (in this case the password has already been entered):


    $ sudo apt install vim

    Click image for larger version

Name:	Sudo-Password.png
Views:	1
Size:	3.0 KB
ID:	649271
    No Sudo Password Shown

    You can enable the password feedback feature in /etc/sudoers file, but first create a backup of the file, then open it for editing using the visudocommand.


    $ sudo cp /etc/sudoers /etc/sudoers.bak
    $ sudo visudo

    Search for the following line.


    Defaults env_reset

    And append pwfeedback to it, so that it looks like this.


    Defaults env_reset,pwfeedback


    Configure Sudoers File

    Now press Esc key and type :wq to save and close the file. But if you are using nano editor, save the file by hitting “Ctrl+x” and “y” then ENTER to close it.


    Then run the command below to reset your terminal for the above changes to start working.


    $ reset

    That’s it, now you should be able to see a visual feedback (****) every time when you typing a password on the terminal, as shown in the following screen shot.


    $ sudo apt update

    Click image for larger version

Name:	Visible-Sudo-Password.png
Views:	1
Size:	2.8 KB
ID:	649272
    Visible Sudo Password

    Last edited by oshunluvr; Jan 15, 2018, 10:49 AM. Reason: changed "yum" to "apt" :), corrected Nano close out.
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes
Working...
X