Throttle a Robocopy

You can throttle a Robocopy to avoid consuming all available network bandwidth by using the /ipg:n switch. This can be helpful if you need to perform a large data copy over a WAN.

To determine the inter-packet gap value to use for n, use the following formula:

D = (Ba-Bd) / (Ba*Bd) * 512 * 1000

Where Ba is available bandwidth in Kibibytes and Bd is the desired bandwidth in Kibibytes.

Also here is a handy calculator to help you test your values.

Continue reading

Encrypt a disk in Ubuntu Linux using Cryptsetup

LUKS Linux Unified Key Setup

Cryptsetup is a utility used to setup disk encryption and is based on the DMCrypt kernel module. It implements LUKS which is the standard for Linux hard disk encryption.

LUKS provides a standard on-disk-format and facilitates compatibility among distributions while also providing secure management of multiple user passwords. In contrast to existing solutions, LUKS stores all setup necessary setup information in the partition header, enabling the user to easily transport the data.

Today we will examine how to setup encryption on a 32GB SanDisk USB thumb-drive using Ubuntu Linux.

Continue reading

Automatically boot your Linux system using rtcwake and a cronjob

rtcwake is a program that is part of the util-linux package, was developed by David Brownell and improved by Bernhard Walle. This command is used to put a Linux computer to sleep and automatically wake it up at a specified time.

This can be useful for automating tasks while also conserving power. I combined this with two simple cronjobs so that my work computer will boot up and shut itself down automatically throughout the week.

To schedule tasks and kickoff scripts in Windows, Microsoft provides Task Scheduler however on Linux we use cronjobs. I am running an Asus Z170-pro motherboard and this process worked without having to tinker with any of the advanced power management settings. Below we will look at the steps that I took to get this configured.

Continue reading

Run rkhunter from a crontab

Rootkit hunter is an open source Unix/Linux based tool that scans for backdoors, rootkits and local exploits on your systems. It scans for suspicious files and works like a file integrity checker.

The team behind rkhunter recommends installing same-class tools like Chkrootkit or OSSEC-HIDS which compliment the overall security of a system. On this entry today we are going to review:

  • How to install rkhunter
  • Create a bash script that can be executed from a crontab
  • Setup the crontab to run daily scans
  • How to prep rkhunter

Continue reading

Grep the mighty tool

When troubleshooting a systems or application problem zeroing in on the logs can be the best place to go to determine the root cause of an issue. Yet some sysadmins tend to overlook the logs or even leave them for last due to the massive amounts of information they tend to contain.

Even if your log directory has gigabytes of data and you haven’t a clue what to search for, below are some steps to get you started in the right direction.

Continue reading