Systems Administration

Cloning hard drive in Linux

May 25, 2016 Systems Administration 12 comments

Hard drive cloning Linux

In this article I show to clone a hard drive in Linux. You will be able to create a mirror of your hard drive, allowing in example to boot operating system from the cloned drive. All you need are two hard drives (or SSD drives) and Linux/Unix operating system. No extra hardware required. (more…)

Find your hardware model names in Linux

May 16, 2016 Systems Administration 2 comments

Linux tutorial

In this short guide I show how to find hardware model names that are installed in your Linux computer. (more…)

Identifying CPU model on Linux computer

April 29, 2016 Systems Administration 1 comment

Linux tutorial

In this article I show how to find CPU model on Linux computer. (more…)

fail2ban SSH on Ubuntu/Debian/Mint

February 15, 2016 Systems Administration 2 comments ,

fail2ban ubuntu debian mint

Is your Ubuntu or Debian server experiencing brute-force attacks on SSH? In this article I am explaining how to secure your server against SSH attacks with fail2ban on Ubuntu and its derivatives (like Mint), as well as on Debian.

If you are looking for instruction for CentOS, see my other post.

fail2ban is a special software that is installed on a server to block intruders’ IP addresses after exceeding configured amount of failed login attempts. (more…)

fail2ban SSH on CentOS

February 15, 2016 Systems Administration 4 comments ,

fail2ban centos

Various malicious bots or human-attackers may be trying to get access to your server over SSH. In this article I will explain how to secure your server against SSH brute-force attacks with fail2ban on CentOS.

If you are looking for instructions for Ubuntu, Debian or Linux Mint, see my other post.

fail2ban is a special software that is installed on a server to block intruders’ IP addresses after exceeding configured amount of failed login attempts. (more…)

How to install Java on Ubuntu with fully automated script

January 31, 2016 Systems Administration 19 comments , ,

How to install Ubuntu on Java

This article explains how to install Java on Ubuntu and its derivatives like Linux Mint. Thanks to UbuntuJavaInstaller, a fully automated Ubuntu Java installer, we can install Java on Ubuntu very fast, simply and effortlessly. (more…)

Check if bash script is run with root permissions

January 31, 2016 Systems Administration No comments

Check if bash script is run with root permissions

Short code snippet to check if bash script is run with root permissions.

Check if bash script is run with root permissions example code.

Below I present code that verifies if bash script is ran with root permissions. The code works without any problems with sudo.

 

Check if bash script is run with root permissions example

#!/bin/bash

# Check if ran with root permissions
if [ `id -u` -ne 0 ]; then
   printf "The script must be run as root! (you can use sudo)\n"
   exit 1
fi

Explanation

The script uses id utility that displays real and effective user ID. Thanks to this utility, we can verify that user runs the script with root privileges. This technique makes the script to effectively detect use of sudo as well.

The root ID is 0 (zero), therefore we compare ID returned by id utility with number zero. If the match is made, we know that the script is executed with root permissions. If it’s not, then we know that the user has no root permissions. In this case, we display an information message and leave the script.

 

How to fix font problems in printing on Ubuntu

December 10, 2015 Systems Administration 5 comments ,

Last time, again, I got a problem with printing documents on my Linux Mint (OS based on Ubuntu). All the documents I printed were missing umlauts (German characters ä ö ü). In past I had the same problem, when my printed documents were missing Polish characters (like Ł). This problem lies in missing or improperly configured fonts. Below you can find how to fix them.

The first thing to try is to install missing fonts. The first set of fonts to try are the Microsoft fonts, as most likely your OS is missing them. You can install them with the following command:

sudo apt-get install ttf-mscorefonts-installer

You can also try to install other fonts, by search for “font” in Synaptic.

If it doesn’t help, reset your fonts configuration:

sudo apt-get install --reinstall --purge fontconfig fontconfig-config

If you was able to print documents properly in the past, the command above most likely will solve the problem.

Learn more about Ubuntu

 

Squid IP whitelist guide

August 22, 2015 Systems Administration 2 comments

Squid proxy and cache server guide

This is a quick guide showing how to configure Squid IP whitelist, limiting connections to Squid proxy server only from particular IPs.

(more…)

How to edit XenServer iptables configuration

August 21, 2015 Systems Administration 2 comments

Citrix XenServer

This is a short step by step guide describing how to edit XenServer iptables configuration using system-config-securitylevel-tui utility.

(more…)