Installing Cobbler 2.6.11 on Ubuntu 16.04

As it took me a bit to figure out, I'll quickly show in this tutorial how to install the latest version of Cobbler on Ubuntu. It may work in a quite similar way also on other linux distributions. First install the prerequisites: apt-get update apt-get install python python2.7 python-django python-netaddr python-yaml python-simplejson python-cheetah python-libvirt python-urlgrabber […]


Remove old kernels on RedHat, CentOS and Fedora

Show installed kernels: rpm -q kernel On Fedora 22 and newer: dnf install yum-utils On earlier Fedora, CentOS and RedHat (RHEL): yum install yum-utils Run the actual cleanup, whereas 2 is in this case the number of kernels that you want to keep: package-cleanup −−oldkernels −−count=2


Getting replication lag in PostgreSQL

Here a 2 simple queries to get the replication lag on Postgres servers: select now() – pg_last_xact_replay_timestamp() as lag; select pg_last_xlog_receive_location() receive, pg_last_xlog_replay_location() replay, ( extract(epoch FROM now()) – extract(epoch FROM pg_last_xact_replay_timestamp()) )::int lag;


Rsync using sudo over SSH

If you can ssh to a remote server using your public key, but want rsync to be executed as a different user, you can achieve it like this: On the remote host add an entry in /etc/sudoers which looks like this (replace the username accordingly): user1    ALL=NOPASSWD: /usr/bin/rsync * This will allow your user […]


Testing if a server port is actually open

There are actually a whole lot of possibilities to do that, the most simple one probably to use a simple telnet: telnet example.net 80 Or the good old nmap: nmap -sS -O -p80 example.net In a Bash script you can simple do it this way: #!/bin/bash test=$(nc -z -v -w1 example.net 80 2>&1) if [[ $test == Connection*succeeded* […]


Hide specific files and folders on ProFTPd

Adding this to your proftpd configuration will hide files and folders starting with a dot which are hidden on linux anyway as well as shell scripts: <Directory /home/*> HideFiles (^\..*|\.sh$) <Limit ALL> IgnoreHidden On </Limit> </Directory>


Using VirtualHosts on a ProFTPd server

When using ProFTPd you may want to have the server listening on different ports, for example if you want to use FTP and SFTP at the same time. Here is an example: <VirtualHost 0.0.0.0 ftp.example.net> SFTPEngine off Port 21 DefaultRoot ~ Umask 022 022 AllowOverwrite on </VirtualHost> <VirtualHost 0.0.0.0 sftp.example.net> SFTPEngine on Port 2222 SFTPLog […]


Installing ProFTPd with Public Key Authentication on Ubuntu 16.04

First install proftpd: apt-get update apt-get install proftpd Next, change the following lines in /etc/proftpd/proftpd.conf: ServerName "sftp.example.net" DefaultRoot ~ Put in your hostname (if it resolves) or IP address as ServerName. The second line will jail the user to his home directory. Next, create the file /etc/proftpd/conf.d/sftp.conf with the following content: <IfModule mod_sftp.c> SFTPEngine on # If […]

sftp-public-key-auth

Installing Postgres 9.4.5 on Ubuntu Trusty

By default on Ubuntu Trusty there is only Postgres 9.3 available This shows how to get the latest version installed. Add the Postgres Repository: echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/postgres.list Import the repository key, and run an update: wget https://www.postgresql.org/media/keys/ACCC4CF8.asc apt-key add ACCC4CF8.asc apt-get update Install Postgres: apt-get install postgresql-9.4