Hi,
I'm new to Linux and Bash. I'm trying to automate VPN connection. I have started a .sh file to get rolling but I'm not sure how to pass my credentials from the executable into the Terminal. The script starts fine and the terminal window opens asking for my sudo password. I haven't been successful at figuring out how to pass the info from the file. Is it possible?
What I've got so far:
cd /etc/openvpn/ovpn_tcp
sudo openvpn us877.nordvpn.com.tcp.ovpn
Thanks in advance
Pass input from file to teminal
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Pass input from file to teminal
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Pass input from file to teminal
Rather than answering that let me ask: Are you aware that you can create a VPN connection via the NetworkManager? If you need OpenVPN specifically, there's a plugin for it available in the Software Manager.
Re: Pass input from file to teminal
You probably don't need to do that, but if you do, I searched with Startpage for 'bash read from file' and got a lot of good returns. Some of them even I could understand!
“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan
-
- Level 4
- Posts: 443
- Joined: Fri Sep 23, 2016 10:19 am
Re: Pass input from file to teminal
I don't recommend storing your password in a file, but if that's what you really want to do:
sudo requires -S to read password from stdin.
Code: Select all
cat .passwordfile | sudo -S openvpn us877.nordvpn.com.tcp.ovpn