在Shell脚本中为用户设置密码 Jun 16th, 2006 echo "test" | passwd test --stdin > /dev/null 2>&1 这条命令可以把test用户的密码设置为test。