Linux System Administration

Many UNIX application are using an EPOCH time to determine a date, on most Linux systems an EPOCH time started on 1.1.1970 and will end on 18.1.2038 as defined by a time_t UNIX C library. Epoch time digit contains a number of seconds since the start of epoch ( 1.1.1970 and 10 hours ).

To get a better understanding consider an example where epoch number is "1". Now convert this epoch time to a real time/ When using bash we can execute a following command:

Rar archive utility is not avaiable on Fedora linux by default. If you are i need to extract / unrar rar archive files you can use official rarlab command line tool.

First download rar utility package for linux from rarlab.com/download.htm .

Extract gzip tarball:

tar xvzf rarlinux-4.0.b6.tar.gz

move rar directory into /opt/

# mv rar /opt/

Next, we need to include rar and unrar executables into our bash shell path so we do not have to enter full path every time we want to execute it. Use your favorite text editor and add / alter a following line into your ~/.bash_profile:

PATH=$PATH:$HOME/bin:/opt/rar/

Now you need to logout and login again and you should be able to extract any rar archive file with unrar executable:

Introduction

In case you will loose your USB stick, all data stored on it will be lost and what is more important they will be most likely in hands of some other person which will then have an access to your private information and use this information in any way s/he sees fit. This is one of many fears of USB stick users. One solution which can be easily applied is to not to store any private information on USB stick, however this will diminish a prime usage of your USB stick to a bare minimum as all non-private data usually do not have to be stored on USB since they can be almost always downloaded anytime and anywhere from the Internet. Another solution is to encrypt your USB stick so it will be accessible only to those users who posses a correct password which will fit to decrypt an used encryption method. This article will deal with the second solution and that is encryption of an USB stick device.

Although encrypting an USB stick seems to be the best and easiest solution it must be said that it also comes with number of disadvantages. The first disadvantage is that decryption of the USB key must be done using a Linux system with kernel version 2.6 and higher which has a "dm_crypt" module loaded in the running kernel. In other words, you cannot use your encrypted USB stick on any Windows machine and UNIX-like system with kernel version below 2.6. Therefore, to encrypt only a part of USB stick which holds only a private information seems to be a good solution. In this article we will use USB stick of capacity 16GB known to the system as a block device /dev/sdc. We first partition the disk to hold two partitions, one for encrypted data and the other for non-private data and then encrypt only single partition intended to hold private data.

NOTE:

All data on your USB stick will be destroyed so Back up your USB stick before continuing. Replace /dev/sdX with file name of your USB block device.

Partitioning an USB stick

Search the output of parted command and retrieve a Disk's file name of your USB stick. As it was already mentioned before, in this article we will use /dev/sdc. Once we have a file name of our USB stick we can create partitions to be used for encryption and for storage of non-private data. In my case I will split the USB stick into two partitions, first with size of 2GB and the rest of the space will be used to create second partition and this will produce /dev/sdc1 and /dev/sdc2 respectively. Use any partition tool you see fit for this purpose, in this article I will use parted as it seems to be becoming a standard these days:

First parted command had created a primary partition with size of 2GB and this partition ( /dev/sdX1 ) will be used to store encrypted data. Second command created a second partition with fat32 file system ( /dev/sdX2 ) starting from 2GB up to last sector ( -1s ). The second partition will serve as a general storage. The final look of your USB stick partition table may look similar to the one below:

Write random data

To avoid pattern based encryption attacks it is advisable to write some random data to a partition before proceeding with an encryption. The following dd command can be used to write such data to your partition. It may take some time. Time depends on the entropy data generated by your system: