Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to creat linux users without interact with the console?

Posted on 2013-01-04
1
Medium Priority
?
566 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 79

Accepted Solution

by:
arnold earned 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Starting up a Project
Suggested Courses

722 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