this post was submitted on 24 Mar 2024
3 points (100.0% liked)

Linux

11 readers
2 users here now

founded 2 years ago
 

I want to run openvpn every time I log on, but currently I run

sudo openvpn --config <myconfig> --auth-user-pass <user/pass>

every time. Is there a way to make it run that automatically and not need my password?

I could make it launch a terminal and run a script but is there a way that would not require me to type my password every time? Can I maybe give myself permissions to whatever openvpn needs so it doesn't need sudo? How do I find out what those permissions are? Is this the right place to ask?

I'm running KDE/Plasma 6 on Manjaro should that matter

edit: Thanks all! I'm going to try the systemd option, if I can't get that working I'll fall back to the cronjob option, and failing that changing openvpn to not need a password for sudo and launching a script at kde statup.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 7 months ago (3 children)
[–] [email protected] 1 points 7 months ago (1 children)

Yeah OP, look into this. It's easy once you get the hang of it, and you don't have to make your system vulnerable by making sudo password less.

[–] [email protected] 2 points 7 months ago

You can make sudo password-less for a single command (including using specific arguments) though, so even if using sudo were the only solution, it wouldn't be that bad. For example, I have a sudoers entry that allows my user to decrypt my ZFS pool by executing a root-owned script (with permissions 700), but everything else requires a password.

[–] [email protected] 1 points 7 months ago

This is the way I would handle this.

[–] [email protected] 1 points 7 months ago (1 children)

That looks pretty straightforward. I'll look into doing that. And if I can;t make it work I'll go with the cron job option suggested by @Andromeda above

[–] [email protected] 1 points 7 months ago* (last edited 7 months ago)

Actually OP, for the easiest, safest option to your system I would say @Supermariofan67 hit the nail on the head. Use your network manager settings: https://forum.manjaro.org/t/automatically-connect-to-vpn-on-startup/46298

If it’s not already installed there’s an openvpn plugin: https://software.manjaro.org/package/networkmanager-openvpn