문제

I am making a shell script that automatically create users, but I cannot think of how to use passwd command within my shell script, how should I use it with shell script? --stdin option doesn't work for me

도움이 되었습니까?

해결책

Try expect(1).

다른 팁

Some implementations of passwd have the --stdin flag which you can use like so:

passwd --stdin user <<<"SoMePasSw0rd"

Works for me on Debian

echo -e "$NEWPASS\n$NEWPASS" | passwd $USER
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top