Fix date time missing in the menu bar in Ubuntu 14.04

Open a terminal and use the command given below. This is optional and just to make sure that you have the indicator installed already.

sudo apt-get install indicator-datetime

Once we have made sure that the indicator is installed, next step is to reconfigure it:

sudo dpkg-reconfigure --frontend noninteractive tzdata

And the last step is to restart Unity:

sudo killall unity-panel-service

That should be it. Now the date time should be appearing in the top panel.

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

Move or migrate user accounts from old Linux server to a new Linux server

in BASH Shell, CentOS, Debian / Ubuntu

Q. How do I Move or migrate user accounts to from old Linux server a new Cent OS Linux server including mails? This new system a fresh installation.

A. You can migrate users from old Linux server to new Linux sever with standard commands such as tar, awk, scp and others. This is also useful if you are using old Linux distribution such as Redhat 9 or Debian 2.x.

Following files/dirs are required for traditional Linux user management:
* /etc/passwd – contains various pieces of information for each user account
* /etc/shadow – contains the encrypted password information for user’s accounts and optional the password aging information.
* /etc/group – defines the groups to which users belong
* /etc/gshadow – group shadow file (contains the encrypted password for group)
* /var/spool/mail – Generally user emails are stored here.
* /home – All Users data is stored here.

You need to backup all of the above files and directories from old server to new Linux server.
Commands to type on old Linux system

First create a tar ball of old uses (old Linux system). Create a directory:
# mkdir /root/move/

Setup UID filter limit:
# export UGIDLIMIT=1000

Now copy /etc/passwd accounts to /root/move/passwd.mig using awk to filter out system account (i.e. only copy user accounts)
# awk -v LIMIT=$UGIDLIMIT -F: ‘($3>=LIMIT) && ($3!=65534)’ /etc/passwd > /root/move/passwd.mig

Copy /etc/group file:
# awk -v LIMIT=$UGIDLIMIT -F: ‘($3>=LIMIT) && ($3!=65534)’ /etc/group > /root/move/group.mig

Copy /etc/shadow file:
# awk -v LIMIT=$UGIDLIMIT -F: ‘($3>=LIMIT) && ($3!=65534) {print $1}’ /etc/passwd | tee – |egrep -f – /etc/shadow > /root/move/shadow.mig

Copy /etc/gshadow (rarely used):
# cp /etc/gshadow /root/move/gshadow.mig

Make a backup of /home and /var/spool/mail dirs:
# tar -zcvpf /root/move/home.tar.gz /home
# tar -zcvpf /root/move/mail.tar.gz /var/spool/mail

Where,

  • Users that are added to the Linux system always start with UID and GID values of as specified by Linux distribution or set by admin. Limits according to different Linux distro:

RHEL/CentOS/Fedora Core : Default is 500 and upper limit is 65534 (/etc/libuser.conf).

Debian and Ubuntu Linux : Default is 1000 and upper limit is 29999 (/etc/adduser.conf).

  • You should never ever create any new system user accounts on the newly installed Cent OS Linux. So above awk command filter out UID according to Linux distro.
  • export UGIDLIMIT=500 – setup UID start limit for normal user account. Set this value as per your Linux distro.
  • awk -v LIMIT=$UGIDLIMIT -F: ‘($3>=LIMIT) && ($3!=65534)’ /etc/passwd > /root/move/passwd.mig – You need to pass UGIDLIMIT variable to awk using -v option (it assigns value of shell variable UGIDLIMIT to awk program variable LIMIT). Option -F: sets the field separator to : . Finally awk read each line from /etc/passwd, filter out system accounts and generates new file /root/move/passwd.mig. Same logic is applies to rest of awk command.
  • tar -zcvpf /root/move/home.tar.gz /home – Make a backup of users /home dir
  • tar -zcvpf /root/move/mail.tar.gz /var/spool/mail – Make a backup of users mail dir

Use scp or usb pen or tape to copy /root/move to a new Linux system.
# scp -r /root/move/* user@new.linuxserver.com:/path/to/location

Commands to type on new Linux system

First, make a backup of current users and passwords:
# mkdir /root/newsusers.bak
# cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

Now restore passwd and other files in /etc/
# cd /path/to/location
# cat passwd.mig >> /etc/passwd
# cat group.mig >> /etc/group
# cat shadow.mig >> /etc/shadow
# /bin/cp gshadow.mig /etc/gshadow

Please note that you must use >> (append) and not > (create) shell redirection.

Now copy and extract home.tar.gz to new server /home
# cd /
# tar -zxvf /path/to/location/home.tar.gz

Now copy and extract mail.tar.gz (Mails) to new server /var/spool/mail
# cd /
# tar -zxvf /path/to/location/mail.tar.gz

Now reboot system; when the Linux comes back, your user accounts will work as they did before on old system:
# reboot

Please note that if you are new to Linux perform above commands in a sandbox environment. Above technique can be used to UNIX to UNIX OR UNIX to Linux account migration. You need to make couple of changes but overall the concept remains the same.

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

All the passwords you should change because of Heartbleed (OpenSSL bug)

The Heartbleed security flaw was fixed in the newest version of OpenSSL, but you should still change your passwords on all of the sites affected by the bug.

If you’re still not sure which sites were affected, here’s the perfect chart for you. Major sites ranging from Facebook and Google to Pinterest and Flickr were affected. Luckily, many financial institutions were not.

HeartbleedFor more information about the Heartbleed OpenSSL bug, visit the Heartbleed.com website.

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

Linux Commands In Structured Order with Detailed Reference

Linux command shelf is a quick reference guide for all linux user who wish to learn linux commands. Commands are divided into 15 categories , which would be more easier to understand what commands to be used in specific requirement. – See more at: LinOxide (you can also download Linux command shelf and Linux cheat sheet as a PDF).
Greetz, M.
Visitor Score
[Total: 0 Average: 0]

Ping with timestamp

When running a ping command for a longer time to trace timeouts, it is hard to determine the actual date and time the timeout occurred.

Using a simple Bash script will solve this issue.

#!/bin/bash
while :
do
	ping -c 10 127.0.0.1
	date
done

This will ping the localhost address ten times and then print date and time. After that the script starts over (infinite loop).

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

Update Samba 3.6 in Ubuntu 12.04

Ubuntu 12.04 LTS is stuck on Samba 3.6.3 which has a lot of bugs. A lot of these have already been solved by the Samba development team, but the new releases are not available in the Ubuntu 12.04 LTS repository.

To update Samba, add the nathan-renniewaldock PPA to your system by entering these commands :

sudo add-apt-repository ppa:nathan-renniewaldock/ppa
sudo apt-get update

Now you can update Samba to version 3.6.7 (especially Windows XP winbind issues which cause Samba crashes)

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

Install latest stable Linux kernel in Ubuntu 12.04

Ubuntu 12.04 LTS is running a kernel from the 3.2 branch.

Newer stable kernel branches are 3.4, 3.5, 3.6 and the newest 3.7. Check the Linux Kernel Archives and the Linux kernel Wiki for the latest information about supported versions / branches.

When installing the latest kernel for Ubuntu, download it from the Ubuntu kernel-ppa/mainline. I used the v3.7.6-raring kernel (latest stable at the time).

Download 32-bit or 64-bit version of headers, image and image-extra plus headers-all file.

Open a terminal and execute : sudo dpkg -i linux-headers-3*.deb linux-image-3*.deb linux-image-extra-3*.deb

 

To uninstall as well as to remove un-use kernel, do following steps:

Boot up Ubuntu, launch Synaptic Package Manager (install it from Ubuntu Software Center) from the dash. Search for and remove following packages:

linux-header-x.x.x.x

linux-header-x.x.x.x-generic (possibly generic-pae or i686)

linux-image-x.x.x.x

x.x.x.x stands for the kernel version you want to remove or uninstall.

After that, run this in terminal (Ctrl+Alt+T):

sudo update-grub

Easy and without any pain !

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

Epson V300 scanner on Ubuntu 12.04

Installing the Epson V300 scanner on Linux is easy !

First, make sure you have installed all the ” Sane”  packages, including ” Sane-utils” .

Next, download the drivers from the Epson website.

There are three packages to download :

  1. iscan-data
  2. iscan
  3. esci-interpreter

Don’t forget to pick the right ones (for Ubuntu use the .deb files, i386 or x64 depending on your system).

Install the packages in the same order (iscan-data, iscan and esci-interpreter).

Switch on the scanner and start “iscan”.

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

HowTo : Samba logrotate fails with errors

On my new Ubuntu 12.04 box logrotate fails on the Samba logfiles log.smbd and log.nmbd.

The issue is the command that is run after log rotation. The ” reload”  parameter is not understood since the init.d scripts are replaced by services.

Simply change the commands to run after rotation.

For log.smbd rotation, change it to : service smbd restart

For log.nmbd rotation, change it to : service nmbd restart

Uning Webmin makes these changes even easier.

Greetz, M.

Visitor Score
[Total: 0 Average: 0]

HowTo : Freshclam logrotate fails with error

On my new Ubuntu 12.04 box Freshclam logrotate failed with errors :

ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: /var/log/clamav/freshclam.log is locked by another process

To fix this I changed the default commands that are run before (default : none) and after rotation.

Commands to run before rotation

/etc/init.d/clamav-freshclam stop

Commands to run after rotation

replace : /etc/init.d/clamav-freshclam reload-log > /dev/null

with : /etc/init.d/clamav-freshclam start

Using Webmin makes these changes even easier …

Greetz, M.

Visitor Score
[Total: 0 Average: 0]