Batch adding multiple users to an instances for multiple pages
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Batch adding multiple users to an instances for multiple pages
Hello:
I would like to add a hundred at a time. Random user name and password. I have had some succcess with Useradd . I am using fedora 32 server. Any help would be great!
Hello:
I would like to add a hundred at a time. Random user name and password. I have had some succcess with Useradd . I am using fedora 32 server. Any help would be great!
Ok, we'll be glad to help, but you have given us next to NO details at all. You don't say what success you've had, what you've done/tried so far, what parameters you want for user names/passwords, etc.
This very much sounds like a homework question; 'random user name and password'?? One hundred users? Show us what you have done/tried so far, and tell us where you're stuck. Otherwise, read the "Question Guidelines" link in my posting signature, along with the LQ Rules about homework questions, and reference any of the MANY bash-scripting tutorials you can find to get you started.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Quote:
Originally Posted by Fred27377
... multiple users to an instances for multiple pages
What does that even mean? Can you clarify that?
Adding users via a batch process has been getting done on UNIX systems for decades and on Linux for, well, decades. I'd be astonished if something didn't come up from a Google search. Let's see ... googling "adding multiple users in linux" ...
For starters, have a look at this thread. A tool that was mentioned there, newusers, may be helpful. But you really should provide more details. You said you have had some success with useradd. So what exactly have you tried? What worked? What didn't work?
"Random user name and password" sounds strange. Should they be read from a file? Or generated on the fly? And how the users are supposed to login then? Anyway, search for a "wordlist generator", there are lots of them, maskprocessor, statsprocessor, cupp, crunch, CeWL, princeprocessor, etc. There are also many password generation tools: gpw, pwgen, apg, makepasswd, mkpasswd.pl, goxkcdpwgen, etc. There are also some tools for generating OTPs: otp, rotp.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Quote:
Originally Posted by shruggy
For starters, have a look at this thread. A tool that was mentioned there, newusers, may be helpful. But you really should provide more details. You said you have had some success with useradd. So what exactly have you tried? What worked? What didn't work?
"Random user name and password" sounds strange. Should they be read from a file? Or generated on the fly? And how the users are supposed to login then? Anyway, search for a "wordlist generator", there are lots of them, maskprocessor, statsprocessor, cupp, crunch, CeWL, princeprocessor, etc. There are also many password generation tools: gpw, pwgen, apg, makepasswd, mkpasswd.pl, goxkcdpwgen, etc. There are also some tools for generating OTPs: otp, rotp.
I've done this in the past using a plain ol' ASCII file, a shell script, and expect long before "newusers" was available. It's hardly rocket science and is probably more portable (across flavors of UNIX, at least). You do have to learn something (Expect is kind of fun to use), though, instead of praying that someone's already created a magic command that does everything you want.
As for the random string generation: even that could be done in a shell script. I have an ancient C program called "monkey" (as in "roomful of monkeys banging on typewriters"; it's never created anything even close to Shakespeare, though) that generates random-length words, sentences, and paragraphs that could be modified for the usernames though, IMHO, a random lookup in a couple of lists -- one with first names, a second with last names -- would work for that.
There are lot of ways to skin this cat---the OP needs to sit down and think about it for a bit.
If this is a homework problem, I'd be interested in knowing what the students were expected to know by this point in the class.
Thank you all for responding! I used an if statement with the else being
Add user name. I wanted to randomize the name and the password. I had trouble
Using crypt and add user because add user pauses in execution. I should have kept some of my notes. It is really just an idea. I should have thought it through.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.