0

I normally add a new user in squid with this command

touch /etc/squid/squid_access; htpasswd /etc/squid/squid_access "NEWuser"

then it prompts me to input the password for "newuser" and conirm it again.

How can I automate this so that I add a range of new users(user1-user500) with the same or password?

humpferey
  • 3
  • 2

1 Answers1

0

You might get what you want with the seq command, on which youu can perform a loop in bash. You might get what you want with this or something similar:

#!/bin/sh
touch /etc/squid/squid_access
for i in $(seq 1 500)
do
    htpasswd /etc/squid/squid_access "new-user-$i"
done
Nino Filiu
  • 16,660
  • 11
  • 54
  • 84