Using the passwd command from within a shell script

前端 未结 13 998
遥遥无期
遥遥无期 2020-11-28 04:20

I\'m writing a shell script to automatically add a new user and update their password. I don\'t know how to get passwd to read from the shell script instead of interactively

13条回答
  •  一生所求
    2020-11-28 04:59

    You can use the expect utility to drive all programs that read from a tty (as opposed to stdin, which is what passwd does). Expect comes with ready to run examples for all sorts of interactive problems, like passwd entry.

提交回复
热议问题