Archive

Archive for April, 2009

Identify what network port is eth0 ?

April 12th, 2009 1 comment

You have two network cables plug in the back of a server and you want to know which one is eth0? Use the following command and the interface light will start blinking (for 10 seconds) on the chosen adapter.

# ethtool -p eth0 10

This command can be run without disturbing the traffic on the interface.

Categories: Network

Epoch time date calculation

April 8th, 2009 No comments

In the Unix/Linux world we always come across at one point with the term “epoch time”. The epoch time is actually the number of seconds elapsed since midnight of January 1, 1970. Some application record the date and time in “epoch time”. Squid proxy server, for an example will record date and time entries in its log in epoch time.

I think we will all agree, that working with this kind of date format is not very meaningful for us. So, if you ever need to convert an epoch time format to a more readable format, here are some example using the bash shell.

Convert epoch time to date format

# date -d @1221256800 "+%Y-%m-%d %T"
 2008-09-13 00:00:00

Convert date to epoch time

# date -d "20080913" +%s"
 1221256800
Categories: Scripting

Force user to change password

April 7th, 2009 No comments

User is calling and say that he forgot is password. So you need to change his password and for security reason you want to force him to change it upon his first login. The command “chage -d 0″ (change aging) will force user to change his password upon first login.

Change his password

   # passwd josblow

Set expiration date to 0

   # chage -d 0


Categories: User admin