Saving username and password OpenVPN config

I use the openvpn command line to connect to a certain VPN site, and I get annoyed at having to find the password everytime

So, in the .ovpn file, there is a setting:


So, I create a file (lets call it new-file.txt) in the same folder as the config, and it only contains 2 lines, first line username, second password

Change the auth-user-pass line to be

auth-user-pass new-file.txt

And now it connects without prompting me for password. Super.

Obviously this is a slight security issue, but this is on a pretty secure VM on a secure machine. So its quite safe. Just think about it if you are implementing the same workaround.

OpenVPN on Linux – save password

My Linux box is secure, so why do I need to remember the extremely difficult to remember password for one of my OpenVPN connections? I don’t.

On Linux, I create a new file, with two lines in it, the first – username, the second – password:


Then, in the ovpn file used for the connection, I add this to the bottom:

auth-user-pass new_filename

Now when I connect, it logs me in automatically

Resetting forgotten MySQL root password

If you have forgotten your root password for MySQL, then don’t panic. Although, if you don’t have root shell access, then do panic!

Anyway, to reset a password, you need to stop MySQL and restart it with a special setting that allows you to login without passwords. Obviously this is a dangerous switch and you have to remember to stop and start MySQL after you’ve finished!


Login with superuser access (sudo su)

> /etc/init.d/mysql stop

This will stop the MySQL service on the server, and all connections will be cut off.

Then we need to start MySQL with the secret switch:

> mysqld_safe --skip-grant-tables &

I don’t get any messages after this, but you may get one saying the mysqld_safe has started.

Then connect as root:

> mysql -u root

You will be connected. And you can just assign the root user a new password:

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD(NEWPASSWORD) WHERE user = "root";
mysql> exit;

That’s it. So now, just stop and start mysql again (as superuser) and were done:

> /etc/init.d/mysql restart