Category: Linux

  • Apache/HTTPd Permissions are missing on a component of the path

    Seeing that error in HTTPd/Apache logs when trying to GET some pages? (13)Permission denied: [client xxxxx]: access to /html/myfile.html denied because search permissions are missing on a component of the path This is because of some SELinux policies blocking the calls. If you don’t want to turn SELinux off, a simple workaround is: chcon -R…

  • Fix the NO_PUBKEY error with apt on Ubuntu

    When updating or installing a package on a Debian-based distribution, you can face that alert: W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY C2518248EEA14886 This just means that a signing GPG key is missing or expired on your system. The error is giving…

  • Extract certificate and/or key from a PKCS12 file

    The PKCS12 format is replacing the old PFX format from Microsoft. This format will allow storage of X.509 private keys and the associated public certificates in a single encrypted file. So you can extract the key and the certificate in a single common PEM file, you can use this openssl command: openssl pkcs12 -in myCertificate.pfx…

  • Automate apt update and keep current config files

    When doing update on a Debian/Ubuntu server, if a package is trying to modify a config file, it’s asking for a manual choice. If you’re trying to try to automate the process, you’d probably like to get rid of that ask and keep the current config file by default. For that, you can use that…

  • Installing Oracle JRE using command line (no repo)

    There is no way to easily automate deployment of Oracle JRE since there is no official repository for most of the linux distros. But there’s still a workaround to automatically download the JRE and install it locally on a server by using command lines. Here is an example of how you can download the JRE…

  • Change the passphrase of your SSH key

    Forgot your SSH key passphrase? There’s an easy way to renew it locally if you have access to it: ssh-keygen -p -f ~/.ssh/id_rsa And then, enter the new passphrase you want to use.

  • Using procmail with custom python script

    If you want to execute some special commands, log or make an API call when you’re receiving an email onto your server, you can easily set up this by using procmail. Procmail is designed to filter and sort emails but can make any call you want. Here, as an example, we will set up a…

  • Execute cron on a specific day of the month (e.g. second monday)

    How to execute a cron on a specific day of the week once in the month? This could look simple as we could think that this line in cron would do the trick: # Run on every second Tuesday of the month 15 3 8-14 * 2 /usr/bin/bash /opt/myscriptfortuesday.sh But this would not work as…

  • Control services on Linux (systemV, systemd, initctl…)

    On Linux, there’s many ways to control services that can run on your system. Here are the main and most known init systems that you can find on the common distros, depending on their version. SystemV That system is one of the oldest and one of the most common. Its init scripts are stored in /etc/init.d/…

  • Generate a CSR with openssl

    Generate a CSR (Certificate Signing Request) on your server when you want to get a certificate from a certified provider is often a mandatory step, very easy to execute. Here are the different steps to execute: Create a specific directory where you will put all your files mkdir sub.domain.com && cd sub.domain.com Generate a private…