How to set password for Grub???

Posted on Updated on

Login as root

Use grub command

[root@rc-090 ~]# grub
grub> md5crypt (it will help to create the md5 hash)…..


How to disable the USB storage device on Linux box ???

Posted on Updated on

Disabling USB storage on a Linux  platform is not more complicated:

Login as root
And added the entry

install usb_storage wall “Critical device malfunction! Drive will be formated”

alias scsi_hostadapter sata_via
remove snd-via82xx { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r –ignore-remove snd-via82xx
install usb_storage wall “Critical device malfunction! Drive will be formated”
alias usb-controller ehci-hcd off
alias usb-controller1 uhci-hcd  off
alias eth0 via-rhine
alias snd-card-0 snd-via82xx
options snd-card-0 index=0
options snd-via82xx index=0

Edit the file   /etc/rc.local
modprobe -r usb_storage

That’s it …

*Keep the syntax corretly

Burning and converting

Posted on Updated on

Burnig and Creating images,copies …..

creating an iso image of afile

1. mkisofs -J -v -o zend.iso /home/installation/Zend-Studio-5.5/
2. dd if=/dev/hdx of=/dev/hdy
3. dd if=/dev/hdx of=/path/to/image
4. dd if=/dev/hdx | gzip > /path/to/image.gz

and Related topics

# dd –help

For more options check dd man page

full hard disk copy

dd if=/dev/hdx of=/dev/hdy
dd if=/dev/hdx of=/path/to/image
dd if=/dev/hdx | gzip > /path/to/image.gz

Hdx could be hda, hdb etc. In the second example gzip is used to compress the image if it is really just a backup.

Restore Backup of hard disk copy

dd if=/path/to/image of=/dev/hdx

gzip -dc /path/to/image.gz | dd of=/dev/hdx

MBR backup

In order to backup only the first few bytes containing the MBR and the partition table you can use dd as well.

dd if=/dev/hdx of=/path/to/image count=1 bs=512

MBR restore

dd if=/path/to/image of=/dev/hdx

Add “count=1 bs=446” to exclude the partition table from being written to disk. You can manually restore the table.

Linux / Unix Command: dd
Command Library
dd – convert and copy a file
dd [OPTION]…

Copy a file, converting and formatting according to the options.

force ibs=BYTES and obs=BYTES
convert BYTES bytes at a time
convert the file as per the comma separated keyword list
copy only BLOCKS input blocks
read BYTES bytes at a time
read from FILE instead of stdin
write BYTES bytes at a time
write to FILE instead of stdout
skip BLOCKS obs-sized blocks at start of output
skip BLOCKS ibs-sized blocks at start of input
display this help and exit
output version information and exit

Burning Audio CDs using cdrecord

Burning audio CDs using cdrecord is a piece of cake, too. Just follow these steps:

  1. Create your audio tracks and store them as uncompressed, 16-bit stereo .wav files.
  2. Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as 01.wav, 02.wav, 03.wav, etc.
  3. Change into the directory containing the wave files and make sure there are not any wave files you do not want included in the CD.
  4. With a blank CD in your burner, issue the following command:

    cdrecord -v -pad speed=1 dev=0,0,0 -dao -audio -swab *.wav

    Again, you may need to adjust your dev parameter as mentioned earlier.

Writing an ISO to a CD-ROM using cdrecord

Assuming that all you want to do is create a CD based on the ISO 9660 file system standard, you can quickly burn the CD using the following command:

cdrecord -v dev=2,0,0 speed=16 -data /home/ubuntu.iso

src.iso is the source filename of the ISO you are burning to the CD-ROM.

Edit GRUB and reset root password, But now we are looking how can set password for grub ??

Posted on Updated on

Login as root
Enter grub mode:
# grub

Use md5crypt to encrypt password:
grub> md5crypt
Password: ******
Encrypted: $1$jxcdN0$hVHViq1aiPf8FziuGJGZp0

Copy down encrypted password:

Exit grub mode:
grub> quit

Modify file /etc/grub.conf:

kate /etc/grub.conf or vi /etc/grub.conf

Insert encrypted password in between “splashimage…” and “title…”:

password –md5 $1$jxcdN0$hVHViq1aiPf8FziuGJGZp0
title BIZ DESK (2.4.20-8elx)

Save edited file

*If you see “#”, means that you have to type the command in the “Terminal” program found on desktop
*Do not include the “#” while executing the command in the “Terminal” program

Now GRUB commands can only be executed at the boot prompt after pressing P and entering the password. However, users can still boot all operating systems from the boot menu.

To prevent one or several operating systems from being booted from the boot menu, add the entry lock to every section in menu.lst that should not be bootable without entering a password.

title CentOS (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-194.el5.img

After rebooting the system and selecting the Linux entry from the boot menu, the following error message is displayed:

Error 32: Must be authenticated

Press Enter to enter the menu. Then press P to get a password prompt. After entering the password and pressing Enter, the selected operating system (Linux in this case) should boot.

How to block USB access in Linux ????

Posted on Updated on

Disabling USB storage on a Linux  platform is not more complicated:

Login as root privilege
#echo ‘install usb-storage : ‘ >> /etc/modprobe.conf
#modprobe -r usb_storage

That’s it …

How to block USB access in MAC????

Posted on Updated on

For OS X the guide describes disabling USB and Firewire storage:

1. Log on with an administrator account.
2. Browse to ‘/System/Library/Extensions’ folder on the system disk.
3. Trash both IOUSBMassStorageClass.kext and IOFireWireSerialBusProtocolTransport.kext which are found in this directory.
4. Empty the trash.
5. Reboot the machine.

Disabling USB storage on a Windows platform is only a little more complicated:

What If You Forget Mysql Root !!!!!

Posted on

If you have set a root password, but forgot what it was, you can set a new password with the following procedure:

1. Take down the mysqld server by sending a kill (not kill-9) to the mysqld. The pid is stored in a `.pid’ file, which is normally in the MySQL database directory: shell> kill `cat /mysql-data-directory/` You must be either the root user or the same user mysqld runs as to do this.

2. Restart mysqld with the –skip-grant-tables option.

3. Set a new password with the mysqladmin password command: shell> mysqladmin -u root password ‘mynewpassword’

4. Now you can either stop mysqld and restart it normally, or just load the privilege tables with: shell> mysqladmin -h hostname flush-privileges

5. After this, you should be able to connect using the new password. Alternatively, you can set the new password using the mysql client:

(1. Take down and restart mysqld with the –skip-grant-tables option as described above.

2. Connect to the mysqld server with: shell> mysql -u root mysql

3. Issue the following commands in the mysql client: mysql> UPDATE user SET Password=PASSWORD(‘mynewpassword’) WHERE User=’root’; mysql> FLUSH PRIVILEGES;

4. After this, you should be able to connect using the new password.

5. You can now stop mysqld and restart it normally.)