S
S
SLAVA2018-10-16 18:30:22
bash
SLAVA, 2018-10-16 18:30:22

How to create users in a range with random passwords?

Dear fellow tribesmen, please help to compile a script that:
1) Creates on all available hosts in the range 192.168.0.192/26 the user foo with a random password (the password must be different everywhere and contain letters of different case + numbers + special characters).
2) Write the information to a local file containing the IP and password for the foo account.

The main problem is how to make the script call all hosts? Obviously, there is a simple solution to such a domestic issue.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sanes, 2018-10-16
@Sanes

Ansible

S
Saboteur, 2018-10-17
@saboteur_kiev

And what about the script?
You first need to set up all available hosts for admin login in order to create users.
Well, if you configure all available hosts, then you create a list of hosts in the process, which means you can simply put this list of hosts in an array or file with the usual for run through it.
Generating a random string is a simple thing, like this:

dd if=/dev/urandom bs=10 count=1 status=noxfer 2>/dev/null | base64

C
CityCat4, 2018-10-17
@CityCat4

In shaggy times, when I set up a server, a pseudo-user was necessarily set up on it and the ssh-key of my central pseudo-user was thrown off to him so that the script could go to the list of servers and execute any command I needed there. But this is a clumsy method.

P
Puma Thailand, 2018-10-17
@opium

Just do it in a loop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question