

- Run openvpn with sudo without password how to#
- Run openvpn with sudo without password install#
- Run openvpn with sudo without password update#
- Run openvpn with sudo without password password#
You may replace %wheel with other group names like %sudoers or other user names like deployer. Now we downloaded the script and it is time to make it executable.
Run openvpn with sudo without password password#
To achieve above in Ansible, refer to the following: - name: sudo without password for wheel groupĬontent: '%wheel ALL=(ALL:ALL) NOPASSWD:ALL' This is more secure than the built-in directives (-user and -group) because the openvpn process is never started with root permissions.
Run openvpn with sudo without password how to#
This page seeks to describe how to instead run as an unprivileged user, 'openvpn', instead. # Allows people in group wheel to run all commandsĪnd instead of fiddling with /etc/sudoers file, we can create a new file in /etc/sudoers.d/ directory since this directory is included by /etc/sudoers by default, which avoids the possibility of breaking existing sudoers file, and also eliminates the dependency on the content inside of /etc/sudoers. History By default, OpenVPN runs as the root user. And to make it password-less is to additionally specify NOPASSWD in /etc/sudoers.Įxample of /etc/sudoers: # Allow root to run any commands anywhere To create a user with sudo privileges is to put the user into /etc/sudoers, or make the user a member of a group specified in /etc/sudoers. And yes.I was able to ssh into the server as "deployer" and run sudo commands without having to give a password. To /etc/sudoers when the playbook is run a subsequent time. It doesn't add the line %wheel ALL=(ALL) NOPASSWD: ALL name: Set up authorized keys for the deployer userĪuthorized_key: user=deployer key=""Īnd the best part is that the solution is idempotent. name: Add deployer user and add it to sudo I am trying to figure out how to use Ansible (version 2.0.2.0 and python 2.7.3) to create a user called "deployer" and be able to log into the server with that id and then so sudo-ish things like "apt-get install". I see 2 options: try to rewrite the script to not need the root / sudo (e.g. Once it is run in cron or (I guess also) by openvpn as called script there is no TTY available.
Run openvpn with sudo without password install#
With this setup, I can log into the server and do stuff like: workstation> ssh sudo apt-get install git Once you run the script manually TTY is availbale. And then add a line like this: username ALL (ALL) NOPASSWD:/usr/bin/apt update, /usr/bin/apt upgrade.
Run openvpn with sudo without password update#
It has a user called "deployer" (used with capistrano), and as such, it needs sudo privileges. For example, if you want the apt update and apt upgrade to be run without entering the password for sudo in Ubuntu, here’s what you need to do. login2.I have taken over a Ubuntu 14.04 server. This makes the script unuseable as my VPN connection would just turn off if I wasn't monitoring it in an open terminal.Ĭould someone be kind enough to review this code, and tell me how to run. login2.sh is still prompting me for a sudo password when it is launched, despite the main script all ready having been given root privileges. login1.sh, However I have removed the following sections: read -sp "Enter Sudo Password: " sudopassword My script so far starts in a seperate directory, and calls these scripts in to action like this: # Project Folder is called: VPN #Īnd so forth. sh file to ensure that the previous VPN connection is terminated: #!/bin/bash If you just close the terminal window without properly disconnecting you might either remain. To disconnect CTRL+C while focused on the terminal window that holds you OpenVPN connection. Leave this terminal window open while you want to be connected to the OpenVPN. I have this saved as a single shell script. Run this in a terminal window: cd cecslinuxopenvpn. Read -sp "Enter Sudo Password: " sudopassword I have succeeded in automating a single login, like this: #!/bin/bash I am trying to write a script that logs me in to OpenVPN configs automatically.
