Ask Your Question
1

pass credentials using a bash script

asked 2018-02-17 19:24:45 -0600

horndog gravatar image

updated 2018-02-18 06:13:40 -0600

FranciscoD_ gravatar image

I'm using Fedora 27 and trying to learn scripting, so I thought I'd try a "simple' login scrip for openvpn.

I need to pass the sudo password, Auth Username, and Auth Password. These credentials would be in the script itself. Security principles are not important since this is a learning exercise. The simple format would look like:

sudo openvpn xx.ovpn
[sudo] password for user:
xxxxxxxx
Enter Auth Username:
yyyyyyyy
Enter Auth Password:
zzzzzzzz

I've found several scripts online, but none work. Am I trying to do something that can't be done? Thanks for any help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-02-18 06:18:55 -0600

FranciscoD_ gravatar image

Hi! This isn't a Fedora specific question, and I'm certain general Linux forums such as stackexchange would have this discussed at length already.

Here is how one can give sudo a password using STDIN: https://stackoverflow.com/a/11955358/... , for example.

For openvpn, the man page tells me that there are different ways of providing credentials, such as using --auth-user-pass <file with username and password>.

So, it can be done, even if it is not suggested. The lesson to take from here, perhaps, is to spend more reading documentation, since both answers were in man sudo and man openvpn :)

edit flag offensive delete link more

Comments

1

Thank you.

horndog gravatar imagehorndog ( 2018-02-23 16:06:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-02-17 19:24:45 -0600

Seen: 253 times

Last updated: Feb 23