When I setup a user on a system, I use 'useradd' and 'passwd'. Using 'passwd' command doesn't show the characters I type, making it tedious to enter long and cryptic passwords for users.
Is there some way to allow me to see what I type in when setting up the password for a new user?
no that I'm aware, hiding the password is considered a feature.
I've tried the old 'echo username:new_pw | chpasswd, which allow me to see what I type, but that command chokes when you use either the '&' or the '!' character in a password, which I believe are allowed special characters.
The problem here is that the shell is an interpreter, and several characters have special meaning,
if the character where only '&' and '|' the problem could have been solved by "quoting" the strings, like follow:
echo "username:new_pw" | chpaswd
unfortunately this will chokes when a 'double quote' ( " ) would be used in the password strings, and others characters too.
An alternate method could be to redirect the input to a temp file containing username:password and then using
chpasswd < tempfile
... provided that you will redirect the "typed in" password without using the shell functions ...
but this will increase the risk, as minimum precaution you should use some secure delete function to overwrite the temp file once the job is done.
Not a very good idea to show out passwords

AS