Wednesday, July 8, 2015

linux - Disable startup program authentication



I want my VPN to run on startup after logging into my user account. Currently running Ubuntu 15.10. I have added the program to startup (/usr/bin/mullvad); however, it asks for authentication before opening.



"Authentication is needed to run 'usr/bin/mtunnel' as the "



I have added these entries to my sudoers file, but it doesn't seem to be doing anything. I still have to enter the password for my VPN to run.



john ALL=(ALL) NOPASSWD: /usr/bin/mtunnel
john ALL=(ALL) NOPASSWD: /usr/bin/mullvad



Any idea?



Full File



#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of

# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$

# Host alias specification


# User alias specification

# Cmnd alias specification

# User privilege specification

Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL


# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

john ALL=(ALL) NOPASSWD: /usr/bin/mtunnel, /usr/bin/mullvad

Answer



Why are you so adamant on connecting to the VPN when you login? You might start it at boot, and then the VPN connection can be performed by root as part of the usual startup.



You can do it in a zillion different ways: you may add a line to /etc/rc.local, you may build a service around it (but the details depend on whether you are under SysV or systemd), or, easier still, you may put the following line




 @reboot /usr/bin/mullvad


in crontab. No more passwords then.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...