Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

write a script that will create user accounts

how to create a script that will add 20 user accounts to the system. The usernames should be a user0 – user19. The uid for the users should be 5000-5019. The comment should be “Regular system user”. The user’s primary group should be system_users.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

For Linux (exec as root)

START_ID=5000
USER_GRP="system_users"
USER_CMT="Regular system user"
USER_SHELL="/usr/bin/bash"

for ((i=0; i<20; i++))
do
   USER_ID=$((START_ID+$i))
   useradd -u ${USER_ID} -g ${USER_GRP}  -c "${USER_CMT}" -s ${USER_SHELL} user${i}
done
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading