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

前端 未结 19 757
北荒
北荒 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:24

    The following works for me and tested on Ubuntu 14.04. It is a one liner that does not require any user input.

    sudo useradd -p $(openssl passwd -1 $PASS) $USERNAME
    

    Taken from @Tralemonkey

提交回复
热议问题