Enable GUI Root login

Enable GUI Root login in Fedora13,RHEL6..etc
Step 1 :-Login as a root from your terminal
[itsolutions@svk]$ su – root
Password:-

Step 2:- Now go to your /etc/pam.d/ directory.
[root@svk]# cd /etc/pam.d/

Step 3:- Edit the gdm file (Find and Comment or remove below mentioned line into your gdm file )
[root@svk pam.d]# vi gdm
#auth required pam_succeed_if.so user != root quiet
Save & Exit From that File. ( In Fedora10 Till step 4 is enought to Login as a root from GUI but for Fedora 13 you need one more file to edit otherwise you cannot Login as a root even though you edited gdm file).

Step 4:- Here is the additional file that you need to edit and that file name is gdm-password. Open gdm-password file editor. (Find and Comment or remove below mentioned line from gdm-password file )
[root@svk pam.d]#vi gdm-password
#auth required pam_succeed_if.so user != root quiet

Step 5:- Save & Exit from File. Now Logout and Try to Login as a root user. Now you are able to Login as a root user from GUI

Small Tips

Make Normal users to run superuser commands

Edit .badhrc file in the users home dir as follows

Add the following line “export PATH=:$PATH:/usr/sbin:/sbin” .Then save and exit.

Relogin and check.

Find the Package name Which installs Particular Command

Find the location of command

# which ls -------> To Find the location of "ls" command

Find the Package name of command

# rpm -qf ls -----> To Find package name which install "ls" command

How to list partition tables

# fdisk -l


How to list filesystem disk space usage
# df -T -h

How to list mounted devices
# mount

How to list PCI devices

# lspci or /sbin/lspci
If the first does not work try the latter.

How to list USB devices
# lsusb

How to forcefully unmount CD/DVD-ROM manually
# umount /media/cdrom0/ -l

How to remount /etc/fstab without rebooting
# mount -a

How to generate MD5 checksum files
# md5sum file.iso > file.iso.md5

How to check MD5 checksum of files
e.g. Assumed that file.iso and file.iso.md5 are in the same folder
# md5sum -c file.iso.md5

How to mount/unmount Image (ISO) files without burning
# mkdir /media/iso
# modprobe loop
# mount file.iso /media/iso/ -t iso9660 -o loop
# umount /media/iso/

How to change computer name
# hostname your_new_computer_name

How to access network folders without mounting
e.g. Assumed that network connections have been configured properly
Network computer’s IP: 192.168.0.1
Shared folder’s name: linux
# smb://192.168.0.1/linux

How to connect into remote Fedora desktop
e.g. Assumed that remote Fedora machine have configured Remote Desktop
Remote Fedora machine: 192.168.0.1
# vncviewer -fullscreen 192.168.0.1:0

How to install support for NTFS
# yum -y install kernel-module-ntfs-$(uname -r)

How to disable history listing in Console mode
# rm -f $HOME/.bash_history
# touch $HOME/.bash_history
# chmod 000 $HOME/.bash_history

How to use Fedora Installation CD, to gain root user access
Insert Fedora CD #1 into your CD-ROM and boot from it
# linux rescue

How to restart GNOME/KDE without rebooting computer
‘Ctrl + Alt + Backspace’

How to switch to Console mode in GNOME/KDE
Press ‘Ctrl + Alt + F1′ (F2 - F6)
To switch back to GNOME/KDE modePress ‘Alt + F7′

How to install/uninstall .rpm files
To install .rpm file # rpm -i package_file.rpm
To uninstall .rpm file # rpm -e package_name

How to set System-wide Environment Variables
# cp /etc/bash.bashrc /etc/bash.bashrc_backupg
edit /etc/bash.bashrc
Append the System-wide Environment Variables at the end of file and save.

How to save “man” outputs into files
# man command | col -b > file.txt

How to convert Wallpaper to Splash Image for GRUB menu
# convert -resize 640×480 -colors 14 wallpaper.png
splashimage.xpm && gzip splashimage.xpm

More Quick How To’s ..............................


FTP Error After Changing the default directory

Following are the common errors will encounter when setting anonymous vsftp
vsftpd-2.0.5error: need to access to a designated dir for anonymous ftpSet following:anon_root=/var/www/html/docs5)
error: 500 OOPS: vsftpd: refusing to run with writable anonymous rootsympton
:Reason:
Change attribute of ftp directory
from drwxrwxrwx 3 root root 4096 Jun 13 18:42 docs
To dr-xr-xr-x 3 root root 4096 Jun 13 18:42 docs
i.e;
# chmod 555 /var/www/html/docs

Removing Duplicate Lines

Removing Duplicate Lines With Sort, Uniq and Shell Pipes
Use the following syntax:
# sort {file-name} uniq -u
# sort ftest.txt uniq -u
Where,-u : check for strict ordering, remove all duplicate lines

Label a Linux Partition

You need to use e2label or tune2fs command line to change the label on an ext2/ext3 filesystem. e2label will display or change the filesystem label on the ext2 filesystem located on device.
Display current label
If the optional argument new-label is not present, e2label will simply display the current filesystem label.
# e2label /dev/sda1
Sample output: /boot
Set a new label
If the optional argument new-label is present, then e2label will set the filesystem label to be new-label. Ext2 filesystem labels can be at most 16 characters long; if new-label is longer than 16 characters, e2label will truncate it and print a warning message.
To set a new label, enter:
# e2label /dev/sdb2 usbstroage
It is also possible to set the filesystem label using the -L option of tune2fs, enter:
# tune2fs -L usbstroage /dev/sdb2

Duplicate Partition

Make an exact duplicate of a NTFS filesystem partition under Linux
First make sure you have created /dev/hdb1 using Linux fdisk program. /dev/hdb1 partitions must be the exact same size of /dev/hda1 so that you create a direct raw copy of source.
Use fdisk -l command to view current /dev/hda1 partition size (cylinders).
# fdisk -l
Now use dd command as follows:
# dd if=/dev/hda1 of=/dev/hdb1

Formatting usb pen in Linux

Step # 1: Verify or find out your usb partition name
Type the following command to find out USB pen partition name:
# fdisk -l
Step # 2: Format parition
Once identified the partition name type the following command to format the usb pen in Linux (caution you must select correct usb partition name, otherwise you will loss all the data on hard disk):
# mkfs.ext3 /dev/sda1
To format as VFAT/FAT32 file system type the command:
# mkfs.vfat /dev/sda1

View Uncommented lines

View Only Configuration File Directives ( uncommented lines of a config file )
To view just the uncommented lines of text in a config file use grep, sed , awk, perl or any other text processing utility provided by UNIX / BSD / Linux systems.
grep example
GNU grep example:
$ grep -v "^#" /path/to/config/file
$ grep -v "^#" /etc/apache2/apache2.conf
# echo 'egrep -v "^\s*#|^$" $1 $2' > /bin/uv ;chmod +x /bin/uv
# echo 'egrep -v "^\s*#|^\s*;|^$" $1 $2' > /bin/uv ;chmod +x /bin/uv
sed example
GNU sed example:
$ sed '/ *#/d; /^ *$/d' /path/to/file
$ sed '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf

Removing blank lines from text files
Task: Remove blank lines using sed
Type the following command:
$ sed '/^$/d' input.txt > output.txt
Task: Remove blank lines using grep
$ grep -v '^$' input.txt > output.txt
Both grep and sed use special pattern ^$ that matchs the blank lines. Grep -v option means print all lines except blank line.

Automount CDROM to a Different Directory

Edit the /etc/sysconfig/autofs file

# vim /etc/sysconfig/autofs
MASTER_MAP_NAME= “auto.master”
TIMEOUT = 5
BROWSE_MODE= “yes”
USE_MISC_DEVICE = “yes”
:wq!

Edit the /etc/auto.master file
# vim /etc/auto.master
/DVD /etc/auto.misc --timeout=5 --ghost
:wq!
# vim /etc/auto.misc

cdrom -fstype=iso9660,ro,nodev,nosuid :/dev/cdrom
:wq!
Now when accessing the /DVD directory the cdrom mounted ...

Reinstalling the Boot Loader

Reinstalling the Boot Loader
In many cases, the GRUB boot loader can mistakenly be deleted, corrupted, or replaced by other operating systems.
The following steps detail the process on how GRUB is reinstalled on the master boot record:
Boot the system from an installation boot medium.
Type linux rescue at the installation boot prompt to enter the rescue environment.
Type chroot /mnt/sysimage to mount the root partition.
Type /sbin/grub-install /dev/hda to reinstall the GRUB boot loader, where /dev/hda is the boot partition.
Review the /boot/grub/grub.conf file, as additional entries may be needed for GRUB to control additional operating systems.
Reboot the system

Mount NTFS Partition

How To Mount NTFS disks

Type this command to determine your kernel version:
[root@lnx ~]# uname -r
2.6.18-128.el5
Download the NTFS kernel modules from:
http://www.linux-ntfs.org/doku.php?id=redhat:rhel5
The current kernel module version of the system at the time of this writing was:kernel-module-ntfs-2.6.18-128.el5-2.1.27-0.rr.10.11.i686.rpm(Download the required rpm according to the kernel version.)
Install the RPM :
# rpm -ihv kernel-module-ntfs-2.6.18-128.el5-2.1.27-0.rr.10.11.i686.rpm
Load the kernel module :
# modprobe ntfs
Find the disk info :
# fdisk -l
One partition should be mentionned as HPFS/NTFS
...
/dev/hdb2 1 1226 97865000 7 HPFS/NTFS
...
Mount the partition :
# mkdir /g_drive
# mount -t ntfs /dev/hdb2 /g_drive

Umount device/mounted directory

How to umount when the device/mounted directory is busy
# umount /storage
umount: /storage: device is busy
umount: /storage: device is busy

This error comes when some running services use this device/directory.So Find out the process ID of the services ,which using the device and kill them one by one ,use the fuser command
# fuser -m /storage or # fuser –m /dev/hdd3
/storage: 2110 2115 2116 2230 ---->Output of the above command..
The find the running process using PID
# ps auxw grep 2110 (For Checking the name of process)
Finally Kill each process or stop associated services.
# kill -9 2110 2115 2116 2230
Now the device/directory will be able to umount