Solved

how to creat linux users without interact with the console?

Posted on 2013-01-04
1
534 Views
Last Modified: 2013-01-17
Dear experts,
I have following requirements:
I must create much users in the centos linux server.
I can do it manually with useradd and passwd command.
But since i have this action done hundreds of times, is there any script who can create the
user and set his password without any interact with console?

Thanks a lot for your valuable information.

Best Regards,
Robert
0
Comment
Question by:matiascx
1 Comment
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 38746357
You have a file with username encrypted_password group
cat filename | while read a b c ; do
If  ( grep "$a" "/etc/passwd" >/dev/null) ; then
 echo alread exists
else
echo useradd -g $c -m -d /home/$a -p "$b" $a
fi
done

If the output is in the correct format, remove echo and let it run
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now