linux

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…)

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

 

Proprietary nVidia drivers under Ubuntu/Mint

October 26, 2014 Systems Administration 2 comments ,

Server Administration and Linux Tipps & Tricks

The problem

If you have troubles with getting proprietary nVidia drivers working in Ubuntu / Linux Mint, you may want to try this solution.

nVidia drivers under Ubuntu/Mint often collide with Nouveau drivers. In such situation the Nouveau drivers are getting loaded, not the proprietary nVidia ones. What you need to do, is to install propretiary nVidia drivers and block loading of the Nouveau drivers. (more…)

How to fix RTL8192cu driver

October 26, 2014 Systems Administration 69 comments

Server Administration and Linux Tipps & Tricks

Infamous RTL8192cu

RTL8192cu fix Linux wifiRTL8192cu is known to cause troubles with wifi for Linux users. The solution is to use original Realtek’s drivers but those are known to have issues with compilation on newer kernel versions (“some warnings being treated as errors” messages). Here is a quick guide how to compile the fixed RTL8192cu for new kernels.

With those instructions I successfully compiled RTL8192cu and got it working under kernel 3.13.02. Commenters and Reddit users reported that they got it working on various 3.x and 4.x kernels as well.

Other problems that this instruction solves:

  • RTL8192cu Linux 3.1
  • RTL8192cu Linux 4
  • compiling RTL8192cu
  • 0df6:0070 drivers
  • rtl8192cu some warnings being treated as errors

 

(more…)

Xinerama moving windows problem

October 20, 2014 Systems Administration 3 comments

Server Administration and Linux Tipps & Tricks

Xinerama moving windows problemAre you a Xinerama user, who runs regularly into a Xinerama moving windows problem like this one on the left?

It’s your lucky day. You have finally found the solution for that damned bug in Xinerama!

I couldn’t find the answer anywhere before. As I have finally fixed it, I am going to share the solution for the other fellow Xinerama users.

I used Xinerama moving windows problem phrase so many times for SEO purposes. It will make people looking for fixing that problem find this website.

I have found this Xinerama moving windows problem happens when you have incorrectly set screen order in your /etc/X11/xorg.conf file. The windows are starting to jump on other monitors when you, for example, try to move a window from screen 1 to screen 3. Not all windows behave like this, but there is software that does it all the time (NetBeans is an example).

To fix and set the screen order properly (which fixes the Xinerama moving windows problem), you need to set screen IDs using a proper order. To achieve that, you need to order the monitors in your xorg.conf file starting from monitor most to the left, ending on monitor most to the right. If you have a multi-level monitors setup as I have, start by numbering left-to-right monitors on top, then continue left-to-right for monitors on bottom.

How to set the screens and identify monitors in xorg.conf file? (more…)