Archive for August, 2009

Difference between ‘mount’ and ‘mount -a’

There is a slight difference between the commands - “mount” and “mount -a”.

1. When you type “mount”, it will display the output of the file “/etc/mtab”.

For example,

# mount
/dev/sda5 on / type ext3 (rw,usrquota)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda7 on /home type ext3 (rw,usrquota)
/dev/sda8 on /tmp type ext3 (rw,noexec,nosuid)
/dev/sda3 on /usr type ext3 (rw,usrquota)
/dev/sda2 on /var type ext3 (rw,usrquota)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)

The content of the file “/etc/mtab” is:

# cat /etc/mtab
/dev/sda5 / ext3 rw,usrquota 0 0
none /proc proc rw 0 0
none /sys sysfs rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda7 /home ext3 rw,usrquota 0 0
/dev/sda8 /tmp ext3 rw,noexec,nosuid 0 0
/dev/sda3 /usr ext3 rw,usrquota 0 0
/dev/sda2 /var ext3 rw,usrquota 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/tmp /var/tmp none rw,noexec,nosuid,bind 0 0

2. When you type the command “mount -a”, it will take the output of the file “/etc/fstab”.

# cat /etc/fstab

# This file is edited by fstab-sync - see ‘man fstab-sync’ for details
LABEL=/ / ext3 defaults,usrquota 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/home /home ext3 defaults,usrquota 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults,usrquota 1 2
LABEL=/var /var ext3 defaults,usrquota 1 2
LABEL=SWAP-sda6 swap swap pri=0,defaults 0 0

Note: The file “/etc/mtab” has the entries of temporary partitions such as USB drive. But, the file “/etc/fstab” has the entries of mounted partitions in the server.

SBDavid

FFmpeg error

FFmpeg error

After installing FFMpeg , when you execute the command : ffmpeg or ffmpeg -v, you may receive an error.

ffmpeg: error while loading shared libraries: libavformat.so.50:

Resolution :

Execute the following command :

export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH

But this value will be cleared once you log off that session.

So it is better to save this value in bashrc.

vi .bashrc
LD_LIBRARY_PATH=/usr/local/lib
SBDavid

Disable direct root login via ssh

Disable direct root login via ssh

Please follow the given steps to disable direct root login access to the server via shell prompt.

STEP 1: Create a user and add it to the wheel group

SSH into your server as root and follow the below commands to create a user.

$ groupadd test
$ useradd test -gtest
$ passwd test

You can create any user instead of “test”.

STEP 2: Add user to wheel group

You can add the user at the end of the ‘group’ file.

$ grep wheel /etc/group
wheel:x:10:root

Add the user test:

wheel:x:10:root,test

For CPanel Servers, do the following.

1. Log into your WHM and click on “Manage Wheel Group Users”.

2. Select the user (Here it is “test”) and click ‘Add to group’.

3. Before disable the root access, check if the user can login and su – to gain root privileges.

SSH into your server as ‘test’

Login as: test

Password : enteryouruserpasswordhere

su –

password: enter root password here

STEP 3: Disable Direct Root Login

1. Copy and paste this line to edit the file for SSH logins

$ vi /etc/ssh/sshd_config

2. Find the line

Protocol 2, 1

3. Uncomment it (Remove #) and change it to look like

Protocol 2

4. Next, find the line

PermitRootLogin yes

5. Uncomment it (Remove #) and make it look like PermitRootLogin no

6. Save the file.

Now, no one will be able to login to root with out first logging in as ‘test’ and ’su -’ to root.

SBDavid

Yum errors

Yum errors

While running ‘Yum update’, if we get the following error,

downloading Packages:

warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID ed00d312

Public key for syslog-ng-2.0.0-1.el4.i386.rpm is not installed

We can fix the error by installing GPG public key.

There are few kind of RPMs e.g atrpms, dag..

You can see the RPM types using the command,

yum list

Below are the ways to install RPM GPG keys for atrpms and dag,

wget http://ATrpms.net/RPM-GPG-KEY.atrpms

rpm –import RPM-GPG-KEY.atrpms

wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
rpm –import RPM-GPG-KEY.dag.txt

SBDavid

Turn on DMA mode on a hard drive

Turn on DMA mode on a hard drive

Direct memory access (DMA) allows certain hardware subsystems within the computer to access system memory for reading and/or writing independently of the central processing unit. It uses a procedure called cycle stealing, where the central processor memory access cycles are delayed for very short times to intersperse DMA controller memory access cycles. DMA is used for transferring data between the local memory and the main memory.

You can turn On DMA mode on a hard drive

You can check whether DMA is enabled on a hard drive for the IDE harddrive.

hdparm -iv /dev/hd

If DMA is on, the output should contain the following line,

using_dma = 1 (on)

If it is off you can enable it as follows,

hdparm -d /dev/hd

This will toggle the value of “using_dma” (It will turn off the value of “using_dma” if it was already on).

« Prev - Next »