how to create users with different id in linux

Dear Experts:

I have centos linux iam looking for how to create a new users (50 users) with userid and gid to start from 6000. Iam aware of usermod but iam looking for new users, similarly want to create additional groups  new groups like QA , PRODUCTION ,QC, like this many more groups .Please help.
Who is Participating?
savoneConnect With a Mentor Commented:
You can do the same for guid with -g

Like so

useradd -u 6000 -g 6000 newuser

For more info Google "man useradd"
You can specify the uid when creating the user like this

useradd -u 6000 newuser

farzanjConnect With a Mentor Commented:
for i in {6000..6050}
    useradd -u $i -g 6000 user$i
    echo "password" | passwd --stdin user$i
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

to set a password on a linux is possible using usermod -p <encrypted_password> username
D_wathiAuthor Commented:
thanks for all. when tried with  useradd -u 6000 -g 6000 newuser  but not  working out. Please help.
arnoldConnect With a Mentor Commented:
what is not working out? You need to provide details as well as a couple of your attempts

the -g needs a group name rather than a numeric.
if you want the group to also have a 6000+ gid you would first use the groupadd -g 6000 newgroup
useradd -u 6000 -g newgroup newuser

id newuser?

Any reason you are not using the common users group for the users?  If some users need to be members of another group you can set that using the -G additionalgroup, additionalgroup2
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.