Category: Linux

  • NRPE – Enable command args (Jessie, …)

    With recent versions of NRPE server, the possibility to enable command args has been disabled. For example, on a Debian Jessie, you can get this kind of error on console: CHECK_NRPE: Received 0 bytes from daemon and in logs: Error: Request contained command arguments! !WARNING! This change can lead to security issue, this is why…

  • Apache – mod_auth compatibility for 2.2 and 2.4

    Since Apache 2.4, mod_auth changed and some directive like Order allow,deny Allow from all that have been replaced with Require all granted If you want to automatically handle same configuration for multiple servers where different versions of Apache are installed, you can use this trick: <IfModule mod_version.c> <IfVersion < 2.4> Order allow,deny Allow from all…

  • Add a confirmation dialog with bash

    If you have a bash script doing some critical actions, it can be useful to add a confirmation dialog to double check with the user that he really wants to perform the action. Here is a very simple script allowing this kind of checking: #!/bin/bash echo “Welcome to your favourite script!” read -r -p “Are…

  • Apache Tomcat – Get logs directly cleaned with rotation

    Tomcat allows you to rotate easily your log files with AccessLogValve but it can be more difficult to get cleaning in logs directories automatically. For that, you can easily use some smart find commands combined with actions: Get logs older than 3 days compressed so they can be smaller but still accessible find /var/log/tomcat/ -mtime…

  • Generate a random file with specific size

    It’s possible to easily generate a random file with specific size filled differently depending on the needs: Fill a 200MB file with zeroes dd if=/dev/zero of=/tmp/file.out bs=1024KB count=200 Fill a 200MB file with random values (longer than zeroes – depending on processor) dd if=/dev/random of=/tmp/file2.out bs=1024KB count=200

  • Escape sequences for SSH (when you’re stuck)

    You can get stuck with your ssh session when your network is changing or when there’s a network disruption. You will face a lock leading to the unability to stop your session, even by doing a CTRL-C. That’s why there’s some escape sequences you can use in that case (especially the first one when you’re…

  • Renew a GPG key when you get “GPG error – KEYEXPIRED”

    Getting this error when trying to update packages on your linux distro using apt? $apt-get update W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://apt.puppetlabs.com jessie Release: The following signatures were invalid: KEYEXPIRED 1468001658 This just means that the GPG…

  • Send an UDP packet with NetCat

    It can be needed to test an UDP connection with a server to ensure that connectivity is working and double check the data received. Let’s take a simple example with a remote logstash server: – Server mylogstash.mydomain.local – Listening on port 5000 On emitter side, we are sending an UDP packet simulating a log line…

  • Find and identify where inodes are used

    Your monitoring system is claiming that your server is running out of free inodes but your disks are not full at all? Maybe you just need to check your filesystem usage and how many files are being used at the same time… Here are some tips to check and identify the inodes being used. First…

  • Skype group chat not working on linux

    With Linux version for Skype, it can happen that group conversation are not working as expected (conversations do not start, or updates are not working, or group members do not appear, …). You can check MSNP version you are using by typing this command in any conversation chat: /dumpmsnp If you are getting this message…