Hi Team,
i need to add users to the centos server using script , the script should
1. ask how many users to be added
2. it should ask us which user to be added to which group(one group or multiple group)
3.once it got the information about the users and group it should check already the user and group exist or not
4. Once the users and group validated it should ask to enter password for the users added
kindly assist in writing the script
Regards
Kanna
need help in adding users in centos
Re: need help in adding users in centos
The point 3 feature -- change only if necessary -- is idempotency. One script that has that is called 'Ansible'.
It can create groups and accounts:
https://docs.ansible.com/ansible/latest ... odule.html
https://docs.ansible.com/ansible/latest ... odule.html
Note that Ansible does not ask from user. It uses variables that you define either in files or on command-line.
You can get Ansible with:
It can create groups and accounts:
https://docs.ansible.com/ansible/latest ... odule.html
https://docs.ansible.com/ansible/latest ... odule.html
Note that Ansible does not ask from user. It uses variables that you define either in files or on command-line.
You can get Ansible with:
Code: Select all
sudo yum install centos-release-ansible-29
sudo yum install ansible