About admin

My name is Vidyadhar Sarmalkar & I work as a consultant and have done RHCE & CCNA.
admin has written 269 articles so far, you can find them below.

How to Disable the Recovery Mode Ubuntu

Today I have given the responsibility to setup Ubuntu machine for school group. Nowadays kids are very smart and they can do the system level changes easily if they know the root password or they can start the machine as a dingle user. I though to disable single user mode / recovery mode booting to make it little bit more secure

To achieve the same I have followed following step which help me to remove single user / recovery mode from GRUB permanently.

Step 1 Open a terminal with Ctrl+Alt+T shortcut and type this command and then hit Enter

gksu gedit /etc/default/grub

Step 2 The above command will open grub default file in gedit text browser. Search for a section like this one

# Uncomment to disable generation of recovery mode menu entries

Remove the # mark from the line #GRUB_DISABLE_RECOVERY=”true”. The changed section should look like this

# Uncomment to disable generation of recovery mode menu entries

Save the file by pressing Ctrl+S then exit Gedit.

Step 3 Then again going to the terminal, execute the below command:

sudo update-grub

Step 4 Restart to see that the recovery option has gone.

How to Password Protect Grub2 Boot Loader Ubuntu

The grub2 password protection procedure can be quite tricky and if you get it wrong there is a possibility of leaving yourself with a non-bootable system. Thus always make a full image backup of your hard-drive first. My recommendation would be to use Clonezilla or PartImage.

If you want to practice this use a virtual machine guest which you can rollback a snapshot.

The procedure below protects unauthorised editing of Grub settings whilst booting i.e, pressing “e” to edit allows you to change the boot options. You could for example, force booting to single user mode and thus have access to your hard-disk.

This procedure should be used in conjunction with hard-disk encryption and a secure bios boot option to prevent booting from live cd.

Almost everything below can be copied and pasted one line at a time.

First lets backup the grub files we will be editing. Open a terminal session and type following:

sudo mkdir /etc/grub.d_backup
sudo cp /etc/grub.d/* /etc/grub.d_backup

Lets create a username for grub:

gksudo gedit /etc/grub.d/00_header &

Scroll to the bottom, add a new empty line and copy and paste the following:

cat << EOF
set superusers="myusername"
password myusername xxxx
password recovery 1234

In this example two usernames were created: myusername and recovery

Next navigate back to the terminal (don’t close gedit):

For Natty and Oneiric users only

Generate an encrypted password by typing


Enter your password you will use twice when prompted

Your PBKDF2 is grub.pbkdf2.sha512.10000.D42BA2DB6CF3418C413373CD2D6B9A91AE4C0EB4E6AA20F89DFA027CA6E6CBF3542CB39E951607E9D651D82700AF47884929BDD193E36CB262CC96201B5789AA.1A9B0033928E3D3D0338583A5BF13AF7D5CC6EC5A41456F8FE8D8EBEB7A093CD0A0CE8688949E6007188ECB3FB0FF916F258602D130CF5C8525FB318FBBE2646

The bit we are interested in starts grub.pbkdf2… and ends BBE2646

Highlight this section using your mouse, right click and copy this.

Switch back to your gedit application, highlight the text “xxxx” and replace this with what you copied (right click and paste)

i.e. the line should look like

password myusername grub.pbkdf2.sha512.10000.D42BA2DB6CF3418C413373CD2D6B9A91AE4C0EB4E6AA20F89DFA027CA6E6CBF3542CB39E951607E9D651D82700AF47884929BDD193E36CB262CC96201B5789AA.1A9B0033928E3D3D0338583A5BF13AF7D5CC6EC5A41456F8FE8D8EBEB7A093CD0A0CE8688949E6007188ECB3FB0FF916F258602D130CF5C8525FB318FBBE2646

All Ubuntu versions (lucid and above)

Save and close the file.

Finally you need to password protect each grub menu entry (all files that have a line that begins menuentry):

cd /etc/grub.d
sudo sed -i -e '/^menuentry /s/ {/ --users myusername {/' *

This will add a new entry i.e users myusername to each line.

Run update-grub to regenerate your grub

sudo update-grub

When you try to edit a grub entry it will ask for your user name i.e. myusername and the password you used.

Reboot and test that username and password is being enforced when editing all of the grub-entries.

Kindly note that remember to press SHIFT during boot to display your grub.

Adding Icons in Notification Area Ubuntu

Recently while doing some testing, I accidentally removed an icon from the Notification area.

I have followed the following steps to add the icons in the the Notification area

Step 1 Right Click on the panel, Go to Panel > Add new Items

Step 2 In the Add New Items window, Click Launcher and Click Add button. A launcher icon will be added to the panel.

Step 3 Right Click on the new Launcher, Select Properties from the popup menu.

Step 4 In the Launcher window, In the General tab, Click on the + button.

Step 5 In the newly appeared Add new Item window, in the search box, type the program name, in my case I want to add pidgin, so I typed “pidgin”, Select the Pidgin icon and Click Add button. The launcher will be converted to pidgin icon.

Step 5 Now, Right click on the newly added icon and select move to move it to the desired position in the panel.

Install the Oracle Java JDK 7 on Ubuntu

Step 1 To start with first we have to download the compressed binary file for your architecture. I am using 32bit OS so i will be downloading 32bit package of JDK. You can download the packages from here.

Step 2 Now uncompress it

tar -xvf jdk-7u2-linux-i586.tar.gz

Step 3 JDK 7 package is extracted into ./jdk1.7.0_02 directory. Now move the JDK 7 directory to /usr/lib

sudo mv ./jdk1.7.0_02 /usr/lib/jvm/jdk1.7.0

Step 4 Now run

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

Step 5 Now run following command to change java path

sudo update-alternatives --config java

You will see output similar one below. Choose the number of jdk1.7.0. For example 3 in this list:

$sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/jdk1.7.0/jre/bin/java 3 manual mode
Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk1.7.0/jre/bin/java to provide /usr/bin/java (java) in manual mode.

Step 6 Check the version of you new JDK 7 installation:

java -version
java version “1.7.0”
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)

Step 7 Repeat the above for:

sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Step 8 Enable mozilla firefox plugin:
32 bit:

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/

64 bit:

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

How to Create Bootable Windows USB Installer through Ubuntu

I want to burn windows iso to usb device in Ubuntu. I tried unetbooting but less luck. So I tried WinUSB.

WinUSB is a simple tool that enable you to create your own usb stick windows installer from an iso image or a real DVD.

This package contains two programs:
- WinUSB-gui: a graphical interface which is very easy to use.
- winusb: the command line tool.

WinUSB supports Windows Vista, Seven, 8 installer for any language and any version (home, pro…) and Windows PE.

To create Windows 7 USB installer follow below steps:

Step 1 : Add WinUSB repository:
Open a terminal and run following command

sudo add-apt-repository ppa:colingille/freshlight
sudo apt-get update

Step 2 : Installing WinUSB
In the same terminal run following command

sudo apt-get install winusb

Step 3 : To create your bootable installer disc, select an ISO image or CD/DVD disc, and click Install.

Since WinUSB also works from the command line, you can create a Windows 7 or Windows Vista USB installer by following the command line format given below:

sudo winusb --format <iso path> <device>

Once the USB is formatted using the above method, install a Windows partition and edit the Master Boot Record:

<pre lang="bash">
sudo winusb --install <iso path> <partition>
Page 6 of 54« First...«456789»102030...Last »
rss twitter facbook