Watch, Read, Listen
-
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…
-
Change or remove password expiration for linux user
It can happen that you’re getting that message when trying to connect to your linux server: You are required to change your password immediately (password aged) WARNING: Your password has expired. You must change your password now and login again! Changing password for user mylinuxuser. (current) UNIX password: The message is quite explicit and you…
-
Update CA trusted root certificates on Linux server
If you’re getting many “unstrusted issuer” alerts in your app logs, it might be due to some CA trusted certificates outdated. To fix that, just perform an update: For Ubuntu/Debian update-ca-certificates For CentOS/RedHat update-ca-trust extract
-
Write multiple lines to file in bash (script)
If you need to push multiple lines to one file through a bash script, you can simply use that syntax: cat > /etc/ntp.conf << _NTPconf_ server 1.2.3.4 server 5.6.7.8 _NTPconf_ Tip: Be aware that if you’re using indentation, last line should not be indented (this would lead you to some errors). If you want to…
-
Find IPs connecting to a postfix server through logs
There’s no easy way to list all the IPs connecting to your postfix server for sending mail. But you can easily extract them from all your postfix logs. For our example, we will consider the logs from postfix to be as default and located in /var/log/maillog Here is what a postfix log look like when…
-
Connect to serial/console terminal with MacOS using screen
It’s possible to connect to serial console with MacOS without using a specific app but only screen. First, you need to find the correct device you will use to connect to the serial console. Depending on your installation and your adapter, you’ll can find it under different names with one these commands: $ ls /dev*/usb*…