Connect to NordVPN on login in Linux
August 11, 2022 ‐ 1 min read
Since remote working has become more and more my standard, I've been connecting to more sketchy Wi-Fi networks than I would like. Think of flex working places and coffee shops. My VPN of choice for these places has been NordVPN. Manually connecting each time gets too annoying after a couple times, luckily we can automate connecting to NordVPN using their command line tools for Linux.
After running the
nordvpn login command, we can run
nordvpn connect to connect to the VPN. The latter command is the one I'm interested in when it comes to automatically connect after logging in.
To run a command after login in Linux we have several options, such as creating a service for your init system, using
@reboot in a cron job or adding a Startup Application via a GUI. For simplicity I'm just adding the connect command to the
~/.profile file to do the trick.
# ~/.profile nordvpn connect
~/.profilefile is typically used to set variables for the user's environment. This file is sourced after login.