I was using weechat when I noticed that if I do a command in the program like /msg IdentServ identify <my-password>
that it actually blanks out your password as you're typing it...see image below:
However...when I use a program in Linux or Windows that requires that you type your password in the Terminal, Cmd.exe or Powershell, passing it usually as a command line argument, it just leaves it out there for everyone looking over your shoulder to see.
Is there a feature like this in Windows or Linux? Is it also possible to do this when pressing the up-key prior to a timeout after which it no longer operates in this manner to re-run the same command again?
I'm aware of things like sudo
and ssh keys for linux, which does kind of solve the problem, but not really aware of anything but Powershell "secure strings" for Windows.
I don't get much to know, by the details you provided, however I assume the question title itself makes all of it and will answer that :
Hiding your password when typed as an argument into a bash shell / command prompt ?
Being a linux user, I would answer it for bash shell
. You can write a shell script that prompts for password like this.
#!/bin/bash
echo -n Password: # Prompt for entering password
read -s password # read password by suppressing it using -s option
echo
echo $password # print password
Here -s
in read command means suppress
that suppress the output stream to show anything. Thus having your password invisible when you type it.
NOTE
: It works in a shell script, but to make it work in applications such as weechat, you have to change the underlying code or better write a shell script that does it when you open the app for the first time.
To read more on this topic follow this and this
Feel free to add-in more details.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments