[X-Unix] ssh sudo password in clear text

B. Kuestner kuestner at macnews.de
Mon Jun 11 13:45:51 PDT 2007


You could wrap the command in a little script and use stty to turn  
off that the password is displayed on screen:

<http://www.tech-recipes.com/bourne_shell_scripting_tips278.html>
> stty_orig=`stty -g`
> stty -echo
> read secret
> stty $stty_orig


<http://tldp.org/LDP/abs/html/system.html>
> Example 16-3. secret password: Turning off terminal echoing
>
> #!/bin/bash
> # secret-pw.sh: secret password
>
> echo
> echo -n "Enter password "
> read passwd
> echo "password is $passwd"
> echo -n "If someone had been looking over your shoulder, "
> echo "your password would have been compromised."
>
> echo && echo  # Two line-feeds in an "and list."
>
>
> stty -echo    # Turns off screen echo.
>
> echo -n "Enter password again "
> read passwd
> echo
> echo "password is $passwd"
> echo
>
> stty echo     # Restores screen echo.
>
> exit 0
>
> # Do an 'info stty' for more on this useful-but-tricky command.

Björn




More information about the X-Unix mailing list