Shell that will generate new users with passwords
Posted: Tue Nov 08, 2011 7:15 pm
Hello.
I have written a shell script which is able to generate a new user for OpenVPN. It works great, though it doesn't support passwords. This is what I'm having trouble with.
Because I don't know how to enter the passwords automatically. I have been using the --batch argument but being fairly new to shell developing I don't find the right syntax to achieve this.
I have written a shell script which is able to generate a new user for OpenVPN. It works great, though it doesn't support passwords. This is what I'm having trouble with.
Because I don't know how to enter the passwords automatically. I have been using the --batch argument but being fairly new to shell developing I don't find the right syntax to achieve this.
Code: Select all
# Changing
./build-key --batch "$usname"
# to
./build-key-pass --batch "$usname"
# But then how to I enter the password using the script ?
# This is what I have tried:
echo "$pass/n$pass/n" | ./build-key-pass --batch "$usname"
# I have also tried using expect but it still stops the scripts and prompts for password
# I guess some of you achieved this before, any help ?
# thank