How to automatically add user account AND password with a Bash script?

前端 未结 19 766
北荒
北荒 2020-12-07 06:53

I need to have the ability to create user accounts on my Linux (Fedora 10) and automatically assign a password via a bash script(or otherwise, if need be).

It\'s eas

19条回答
  •  没有蜡笔的小新
    2020-12-07 07:41

    --stdin doesn't work on Debian. It says:

    `passwd: unrecognized option '--stdin'`
    

    This worked for me:

    #useradd $USER
    #echo "$USER:$SENHA" | chpasswd
    

    Here we can find some other good ways:

    • http://www.debian-administration.org/articles/668

提交回复
热议问题