Archive for the 'General' Category

Quickly sync/update time from a time server

A good server machine should always tick its clock with correct time. The best way to keep it in shape is to sync with a time server.

You can use any preferred time server to sync. I’m using public time servers here:

# ntpdate pool.ntp.org
5 Feb 11:17:00 ntpdate[3332]: step time server 220.225.252.202 offset -585.969659 sec

Network time update command (ntpdate) will contact the avaiable time server from public pool and sync time with it. Here in above example, offset is denoting that the clock was running ahead of time in my server.

Create bootable USB drive with Fedora 10 live

How about having a linux bootable USB stick? You can insert that in to any PC, do the do without affecting settings of that PC at all. This is even more helpful for linux admins who find it hard to work on friend’s Windows PC instead of taking delicious dinner, after receiving an unrgent call from NOC Deptt.

Here are quick steps on CentOS 5.2 box (should be identical on any RH based distro):

1. Check whether required tools are already installed or not:

# rpm -q livecd
<no output>

2. Install tools:

Quickly change your ssh port from default 22 to something higher

In the era of daily brute force attacks, it is advisable to change your ssh port from defaul 22 to something higher to lower your chances of being a victim.

I’m using CentOS 5.2 box here but the process should be identical in other RH based distros.

1. Update /etc/ssh/sshd_config file, line 13 (it might be different in your file):

old line:
Port 22
Change it to:
Port 54545 # any port number you wish

if you rush and try to restart your ssh service, you may end with getting error:

Change TimeZone in your Linux Server quickly:

In any Red Hat based (RHEL/CentOS/Fedora) Server, change time zone to PST/PDT quickly:

# mv /etc/localtime /etc/localtime.old && ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime

or set zone to IST:
# mv /etc/localtime /etc/localtime.old && ln -s /usr/share/zoneinfo/Calcutta /etc/localtime

or Set the TZ environment variable for quick display time according to preferred Time Zone:
# export TZ=America/Los_Angeles
and then view the output of date command.

or If you have the utility rdate, update the current system time by executing
# rdate -s pool.ntp.org

or You can execute ‘system-config-date’ for setting up date/time and time zone:
# system-config-date

FTP Error: Could not write to socket: Broken pipe

By viewing this error while using your ftp server, you may get the impression of some bug/problem in your ftp server. This is exactly what happened in the early morning when I got call that vsftpd server in one of the Amazon EC2 server stopped working. When tyring to transfer a file it’s showing something like this:

Error: Could not write to socket: Broken pipe
Unable to download file xxxx

Get Adobe Flash playerPlugin by wpburn.com wordpress themes