Category Archives: Linux

Force Apt-get to use IPv4 on Debian Linux

In some VPS or servers you may get errors when doing apt-get due to IPv6. To force apt-get to use IPv4 just type this command: echo ‘Acquire::ForceIPv4 "true";’ | tee /etc/apt/apt.conf.d/99force-ipv4echo ‘Acquire::ForceIPv4 "true";’ | tee /etc/apt/apt.conf.d/99force-ipv4 The setting will be permanent.

Install MariaDB 10.3 Server on Debian Linux

To install MariaDB 10.3 server on Debian Linux just type: apt-get install -y -q software-properties-common dirmngr apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 add-apt-repository "deb [arch=amd64,i386,ppc64el] http://mariadb.mirror.nucleus.be/repo/10.3/debian stretch main" apt-get update apt-get install mariadb-serverapt-get install -y -q software-properties-common dirmngr apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 add-apt-repository "deb [arch=amd64,i386,ppc64el] http://mariadb.mirror.nucleus.be/repo/10.3/debian stretch main" apt-get update apt-get install mariadb-server

Install Only MariaDB Client on Debian Linux

To install only MariaDB client on Debian Linux just type: apt-get install -y -q software-properties-common dirmngr apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 add-apt-repository "deb [arch=amd64,i386,ppc64el] http://mariadb.mirror.nucleus.be/repo/10.3/debian stretch main" apt-get update apt-get install mariadb-clientapt-get install -y -q software-properties-common dirmngr apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 add-apt-repository "deb [arch=amd64,i386,ppc64el] http://mariadb.mirror.nucleus.be/repo/10.3/debian stretch main" apt-get update apt-get install mariadb-client

Create a Custom Mount Point with Noexec on Debian

Lets say we want to create a new mount point /test with flag “noexec” but we cannot create a new partition because, for example, we are using a VPS. How can we do that? Simple, we can create a file, make it an ext4 file system, mount it with “noexec” flag, and edit /etc/fstab to […]

How to Secure /tmp and /var/tmp on your VPS

It is very important to disable scripts execution on /tmp and /var/tmp. This way an attacker would not be able (at least not that easily) to become root by executing local root exploits or other bash scripts. We will use the flag “noexec” to disable execution of bash scripts on temp folders. * This guide […]

Lets Encrypt certificate failed to renew

On a VPS I noticed that Lets Encrypt certificate failed to automatically renew correctly. After some research, I noticed that this issue was caused due to the certbot/letsencrypt script that didn’t execute the “post-hook” code (to reload the web server) after the certificate was renewed. Infact the certificate was renewed according to letsencrypt logs: Saving […]

Renew an expired Lets Encrypt / Certbot certificate

Yes it is possible to renew expired Lets Encrypt / Certbot certificate. First try to run the “-renew” command like this: certbot renew or letsencrypt renewcertbot renew or letsencrypt renew Then make sure to restart/reload your web server: /etc/init.d/nginx reload or /etc/init.d/nginx restart/etc/init.d/nginx reload or /etc/init.d/nginx restart That’s all.

Run MySQL command in background on Linux

Run a MySQL command in background from SSH command-line on Linux: nohup mysql -h localhost -u username -p’password’ databasename -e "ALTER TABLE users DROP COLUMN email;" >/dev/null 2>&1 &nohup mysql -h localhost -u username -p’password’ databasename -e "ALTER TABLE users DROP COLUMN email;" >/dev/null 2>&1 & In the above command-line we run this MySQL command: […]