linux poison RSS
linux poison Email

Add Microsoft True Type Fonts into Linux

If you are a regular user of windows and have switched to linux recently, then sure you are going to miss some important things from your windows machine. One such things is those beautiful fonts which you have used in windows.

Method 1:
For installing these fonts there various methods available one among them is as below,

* Install a Cab Extract Utility for Linux. Get it from
* Download the Latest msttcorefonts spec from
* If you have RPM Build environment in your home directory, then go ahead with the command. rpmbuild -bb msttcorefonts-2.0-1.spec
* Install the newly built rpm using the following command rpm -ivh <>
* Once done, log off & log in or restart the xfs service using the command /sbin/service xfs reload

Method 2:
use RPM method,

* rpm -ivh msttcorefonts-2.0-1.noarch.rpm

You should be logged in as a super user or use sudo

Read more

HowTo Add PATH

To add or remove a directory in your path, use a text editor to change the shell variable `PATH’ in the `.bashrc’ file in your home directory

For example, suppose the line that defines the `PATH’ variable in your `.bashrc’ file looks like this:


You can add the directory `/home/nikesh/bin’ to this path, by editing this line like so:

Read more

HowTo chang the file modification time

Use touch to change a file’s timestamp without modifying its contents. Give the name of the file to be changed as an argument. The default action is to change the timestamp to the current time.

* To change the timestamp of file `nikesh’ to the current date and time, type:

$ touch nikesh

To specify a timestamp other than the current system time, use the `-d’ option, followed by the date and time that should be used enclosed in quote characters. You can specify just the date, just the time, or both.

* To change the timestamp of file `nikesh’ to `17 May 2006 14:16′, type:

$ touch -d ‘17 May 2006 14:16′ nikesh

* To change the timestamp of file `nikesh’ to `14 May’, type:

$ touch -d ‘14 May’ nikesh

* To change the timestamp of file `nikesh’ to `14:16′, type:

$ touch -d ‘14:16′ nikesh
Read more

What are TCP control bits

There are six ‘control bits’ defined in TCP, one or more of which is defined in each packet. The control bits are ‘SYN’, ‘ACK’, ‘PSH’, ‘URG’, ‘RST’, and ‘FIN’. TCP uses these bits to define the purpose and contents of a packet.

SYN bit is used in establishing a TCP connection to synchronize the sequence numbers between both endpoints.

ACK bit is used to acknowledge the remote host’s sequence numbers, declaring that the information in the acknowledgment field is valid.

PSH flag is set on the sending side, and tells the TCP stack to flush all buffers and send any outstanding data up to and including the data that had the PSH flag set. When the receiving TCP sees the PSH flag, it too must flush its buffers and pass the information up to the application.

URG bit indicates that the urgent pointer field has a valid pointer to data that should be treated urgently and be transmitted before non-urgent data.

RST bit tells the receiving TCP stack to immediately abort the connection.

FIN bit is used to indicate that the client will send no more data (but will continue to listen for data).
Read more

Temporarily suspend a process

At times, you may find it necessary to temporarily suspend a process, and then resume its execution at a later time. The following two commands will suspend a process, and the resume it, respectively:

# kill -STOP 945
# kill -CONT 945
Read more

How to add a module to an existing kernel

Sometime you need to add a new driver to a modular kernel, you can just compile the needed module and install it without recompiling the entire kernel. Just follow these steps:

# cd /usr/src/linux (location where linux kernel source is stored)
# make config Or make menuconfig OR make xconfig
(Choose the driver as a module)

# make dep
# make modules
# make modules_install
# depmod -a

You should now be able to use the new module.
Read more

How to do Virtual hosting in Vsftpd

There are two ways of doing this ...

1. If you integrate vsftpd with xinetd, you can use xinetd to bind to several different IP addresses. For each IP address, get xinetd to launch vsftpd with a different config file. This way, you can get different behavior per virtual address.

2. Alternatively, run as many copies as vsftpd as necessary, in standalone
mode. Use “listen_address=x.x.x.x” to set the virtual IP.
Read more

Prevent the reuse of old passwords

The PAM module can be configured to maintain a list of old passwords for every user prohibiting the reuse of old passwords.

The list is located in the /etc/security/opasswd file. This is not a plain text file, but it should be protected the same as the /etc/shadow file. This is normally referred to as password history.

To remember the last 5 passwords, add the line below to the /etc/pam.d/system-auth file:

password sufficient /lib/security/ use_authtok md5 shadow remember=5

Read more

Install multimedia Support in Fedora 8

Follow these instructions to get mp3 and other multimedia support on your Fedora Core 8.

Open a terminal and become root, then run this command:

# wget
# rpm -ivh livna-release-8-1.noarch.rpm

Install all other plug ins..

# yum -y install gstreamer-plugins-bad gstreamer-plugins-ugly xine-lib-extras-nonfree
Read more

How to Encrypt - Decrypt your files

To Encrypt a normal file:
$ openssl des3 -salt -in myfile.txt -out outputfile.des3
[This will ask for password, give any pass that you can remember]

To Decrypt:
$ openssl des3 -d -salt -in outputfile.des3 -out myfile.txt -k password
Read more

Recover MySQL database root password

You can recover MySQL database server password with following five easy steps.

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password

Step # 3: Connect to mysql server as the root user

Step # 4: Setup new root password

Step # 5: Exit and restart MySQL server

Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password

# mysqld_safe –skip-grant-tables &

[1] 5988

Starting mysqld daemon with databases from /var/lib/mysql

mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client

# mysql -u root

Output:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-logType ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.


Step # 4: Setup new MySQL root user password

mysql> use mysql;

mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD“) where User=’root’;

mysql> flush privileges;

mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld STOPPING server from pid file /var/run/mysqld/
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe –skip-grant-tables

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start

# mysql -u root -p
Read more

BackUp and Restore MBR after Windows messes it up

Just another note about restoring the boot loader for dual boot systems, after Windows messes it up. In Linux, the “dd” command can read and write to/from raw disks and files. If you have a floppy drive, creating a boot disk is as simple as putting a floppy in the drive and typing this:

[You need to use "root" account to do following]

# dd if=/dev/hda of=/dev/fd0 bs=512 count=1

This makes an exact copy of the MBR of the first hard drive (hda - you need to replace this), copying it to a floppy disk. You can boot directly from this floppy, and see your old boot menu. You can restore it by switching the “if=” and “of=” (input file, output file) parameters.

If you don’t have a floppy drive, you can back it up to a file with this:

# dd if=/dev/hda of=/home/nik/boot.mbr bs=512 count=1

Then you can boot into a CD-ROM distribution such as Knoppix, or often use your Linux distribution’s installation CD to boot into rescue mode and restore it with:

# dd if=/mnt/hda5/nik/boot.mbr of=/dev/hda bs=512 count=1

(you’ll need to find and mount the partition containing the directory where you backed up the MBR).
Read more

How to use rsysnc to keep files in Sync Between Servers

Suppose remote computer is “″ and has the account “don”. You want
to “keep in sync” the files under “/home/Logs” on the remote computer with files on “/home/nikesh/Server” on the local computer.

$ rsync -Lae ssh don@ /home/nikesh/Server

“rsync” is a convient command for keeping files in sync, and as shown above, it will work
through ssh. The -L option tells rsync to treat symbolic links like ordinary files.

Also see []
Read more

Sync Samba and Unix password

The pam_smbpass PAM module can be used to sync users’ Samba passwords with their system passwords. If a user invokes the passwd command, the password he uses to log in to the system as well as the password he must provide to connect to a Samba share are changed.

To enable this feature, add the following line to /etc/pam.d/system-auth below the invocation:

password required /lib/security/ nullok use_authtok try_first_pass

Read more

Quick Apache configuration tips

Enable Directory Browsing
Options +Indexes

## block a few types of files from showing
IndexIgnore *.wmv *.mp4 *.avi

Disable Directory Browsing
Options All -Indexes

Customize Error Messages
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html

Get SSI working with HTML/SHTML
AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
# AddHandler server-parsed .htm

Change Default Page (order is followed!)
DirectoryIndex myhome.htm index.htm index.php

Block Users from accessing the site
order deny,allow
deny from
deny from
deny from
allow from all

Allow only LAN users
order deny,allow
deny from all
allow from

Redirect Visitors to New Page/Directory
Redirect oldpage.html
Redirect /olddir

Block site from specific referrers
RewriteEngine on
RewriteCond %{HTTP_REFERER} site-to-block\.com [NC]
RewriteCond %{HTTP_REFERER} site-to-block-2\.com [NC]
RewriteRule .* - [F]

Block Hot Linking/Bandwidth hogging
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

Want to show a “Stealing is Bad” message too?
Add this below the Hot Link Blocking code:
RewriteRule \.(gif|jpg)$ [R,L]

Stop .htaccess (or any other file) from being viewed
order allow,deny
deny from all

Avoid the 500 Error
# Avoid 500 error by passing charset
AddDefaultCharset utf-8

Grant CGI Access in a directory
Options +ExecCGI
AddHandler cgi-script cgi pl# To enable all scripts in a directory use the following#
SetHandler cgi-script

Change Script Extensions
AddType application/x-httpd-php .gne
gne will now be treated as PHP files! Similarly, x-httpd-cgi for CGI files, etc.

Use MD5 Digests
Performance may take a hit but if thats not a problem, this is a nice option to turn on.
ContentDigest On

Save Bandwidth
# Only if you use PHP
php_value zlib.output_compression 16386

Turn off magic_quotes_gpc
# Only if you use PHP
php_flag magic_quotes_gpc off

Read more
Related Posts with Thumbnails