Posts Tagged ‘ubuntu’

Modify $PATH for root account Ubuntu / Linux Mint

March 6th, 2011 No comments

The way to modify $PATH on Ubuntu / Linux Mint is a bit different from that of other Linux distros. When you have tried several ways to modify $PATH but to no avail, give yourself a chance to try this and see =).

To modify all users’ $PATH, edit this file: /etc/profile

To modify root’s $PATH, edit this file: /etc/environment

Shutdown a Windows box from Ubuntu / Linux Mint

January 8th, 2011 No comments

If you ever want to shutdown a Windows XP box remotely from Ubuntu or Linux Mint, this post is worth trying ;) .

The only command to know is ‘net rpc shutdown’ with few parameters. Try the following which makes a successful shutdown signal on my Windows XP box.

administrator@user ~ $ net rpc shutdown -C “going to shutdown” -f -I -U administrator%admin123

Shutdown of remote machine succeeded

Parameters from man page:

-I ip-address
IP address of target server to use. You have to specify either this
option or a target workgroup or a target server.

RPC SHUTDOWN [-t timeout] [-r] [-f] [-C message]
Shut down the remote server.

Reboot after shutdown.

Force shutting down all applications.

-t timeout
Timeout before system will be shut down. An interactive user of the
system can use this time to cancel the shutdown.

-C message
Display the spec

If that simply doesn’t work for you the first time, then read this article and solve the requirement.


How To Remotely Shut Down Windows XP Computers From A Linux Server

As a budget cutback, our school administrators asked us to shutdown all non-essential classroom computers at night to save electricity. I teach Linux in a classroom that has a Dell Poweredge 2850 Red Hat Enterprise Linux (RHEL5) server and 29 Dell Optiplex 745 student lab computers running Microsoft Windows XP SP3 as the host operating system and VMWare Server to provide virtual Linux machines for our classes. I researched on the Internet for the best solution to remotely shutdown the student lab computers at night. I was not able to find one post or how-to that completely answered my questions, but I was able to piece together a solution. In an effort to document this project and help others with similar needs, here are my notes on the project:


  1. Disable Simple File Sharing. UNCHECK “Use simple file sharing” under My Computer > Tools > Folder Options > View.
  2. Check the Windows Firewall and make sure ICMP is enabled and File and Printer Sharing is enabled. Go to Control Panel > Security Center > Windows Firewall > Exceptions > CHECK “File and Printer Sharing”. Also on the Advanced tab > ICMP Settings > CHECK “Allow incoming echo request”.
  3. You must be able to successfully ping the IP address of the remote Windows XP computer you want to shutdown.
  4. The default Local Policy in Windows XP to force a remote shutdown is limited to members of the Administrator group. If you want to change this, use the Group Policy Editor (gpedit.msc) to change this Local Policy. Select Computer Configuration > Windows Settings > Security > Local Policies > User Rights Assignment > Force shutdown for a remote system and change the properties to include the user or group you want to have this authority.


  1. Samba must be installed and working properly. In our subnet, the RHEL5 Samba Server is configured as a WINS server for our own separate workgroup.
  2. It is recommended that the DHCP server be setup to assign static IP addresses to the Windows XP computers. This makes control of the lab computers much easier.
  3. It is also recommended that BIND be setup with a zone file for the subnet to provide DNS resolution for the computers in the lab subnet.
  4. The following command will remotely shutdown a Windows XP computer under this scenario:net rpc SHUTDOWN -C “enter a comment to display at shutdown” -f -I x.x.x.x -U username%passwordIn this example x.x.x.x is the IP address of the remote Windows XP computer, username is a member of the Administrator group on the Windows XP machine, and password is the correct password associated with the username.
  5. Test your configuration. Samba is very good about letting you know if your command works correctly or if you have problems.
  6. Next create a script to shutdown the Windows XP machines. Use crontab to schedule when you want the remote machines shutdown.

Recommended good softwares for Linux Mint / Ubuntu

November 30th, 2010 No comments

Linux is a good and powerful operating system. If you are a non-MS developer or you can’t afford MS products (Windows, Office), you should consider using Linux. Though there are many Linux distros out there, I recommend Linux Mint for its elegance and cool customizations for home end-users. If you’ve been a Windows user, you will feel a similar environment with Linux Mint.

Here is a list of softwares (IMHO) in no order that I recommend for Linux Mint (applicable to Ubuntu too as Linux Mint is based on Ubuntu).

arpon – Arp handler inspectiON

Protects your ARP cache.


A good download manager like Free Download Manager for Windows. It supports multi-thread per each download.


Expand diskspace of your OS, use this when you install Ubuntu/Linux Mint as a software under Windows.


A famous Windows compatibility layer. With Wine, you can install and run Windows softwares with no problem in Linux.


A lite video editor, good for average demand.


A super good web browser.


Yet another super good browser. It loads and displays Flash web pages faster than Firefox, but is very resource-consuming.


Similar to AllToTray software for Windows, it can hide chosen window and shows a corresponding icon on the system tray. Click that icon to open the window again.


A good screenshot tool compared to default ones. However it cannot capture long web page.


Lets you create as many operating systems as you want inside Linux. It performs excellently comparable to VMWare.


Similar to TortoiseSVN, it lets you do all svn-related tasks with a right click.

Java Decompiler –

A really good tool for Java developer, comparable to to DJ Java Decompiler for Windows.


Good SSH tool for developers for years ;) . I like the way using GUI to store accounts, fonts, tunnels, etc.

Firewall graphical front-end: Firestarter, GUWF

Linux uses iptables as the actual firewall, so we just need a good and reliable GUI to iptables. Firestarter, GUFW are good candidates, but use one of them only.

Meld Diff Viewer

Similar to WinMerge for Windows, it is strong at comparing and merging files.

Google Picasa

This is a good software for managing image files on your computer.


Similar to Notepad++ for Windows, it is a lightweight superstar for editing files.

SCIM Unikey

A reliable tool for typing Vietnamese characters. This is good if you’re going to learn and use Vietnamese in your near future of course!


A tool used for editing the GConf configuration database. GConf is a configuration database system for storing application

Oracle VM VirtualBox

A good free software to create virtual machine of your choice.


A cool music player, integrating, podcast, radio and music stores (Jamendo, Magnatune).

Nautilus Image Converter

If you’ve ever known Image Resizer Powertoy for Windows XP, you will find this a similar useful tool for Linux. It integrates in right mouse menu context. It supports resizing and rotating images.

Ways to protect your computer against ARP poisoning

November 10th, 2010 No comments

When you’re connected to a local area network, you’re exposed to many security troubles that you may not be aware. One of them is ARP spoofing (ARP poisoning). The attacker can easily capture data flow in and out of your computer. Your essential information such as username, password, email are not secret to you anymore. Read wiki page here:

An attacker may take advantage of ARP poisoning to perform the following effects:

1. Denial of Service attack

- computer A sends request to (true) gateway successfully

- computer B (hacker) poisons ARP cache of gateway

- as a result, gateway sends response to fake computer B. Hacker may never send response back to computer A. Computer A may see these symptoms on the browser: Waiting for, Looking up

Instant resolution (either or all will work):

- clear ARP cache of gateway

- turn gateway off and on

- reset gateway

- turn on gateway’s ARP protection

2. Man in the middle (MITM) attack

- computer B (hacker) poisons ARP cache of gateway and computer A, it acts as an intermediate between computer A and true gateway

- computer B can sniffer data flow between computer A and gateway, thus it can analyze to see essential information (username, password, URL, cookie, …)

Instant resolution (either or all will work):

- clear ARP cache, repair network connection

- enable firewall’s ARP cache protection (enable ArpON in Linux box)

- perform resolutions of DOS attack

Disable touchpad in Linux Mint (part 2)

November 4th, 2010 No comments

Today I find a useful script on Ubuntu forum ( It can check for usb mouse and perform operation to enable/disable touchpad.

Here is the script that I customize for my Linux Mint.

# Toggle touchpad on and off
# Author: Heath Thompson
# Email:
# For startup wait for desktop to load first.
while true
if ps -A | grep gnome-panel > /dev/null;
echo ‘X loaded’
echo ‘X not loaded, waiting…’
sleep 5
# Check to see if appletouch is running
# if lsmod | grep appletouch > /dev/null;
# then
# echo ” * Appletouch enabled”;
# else
# echo ” * Appletouch either not working or not installed”
# killall mouseSwitcher
# fi

while true
# ‘xinput list’ will list all input devices x detects
# I could reference my usb mouse by ID but I’m afraid that if I plug
# another device in before my mouse, it might not have the same ID each
# time. So using the device name makes it relatively fail-safe.
if xinput list ‘Logitech USB Laser Mouse’;
# Found my usb wireless mouse
# Disable everything on the Touchpad and turn it off
#synclient TouchpadOff=1 MaxTapTime=0 ClickFinger1=0 ClickFinger2=0 ClickFinger3=0;
# Ends all syndaemon capturing which may have been used to monitor the touchpad/keyboard activity
#killall syndaemon

# custom for asus f8p
xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0
# My usb wireless mouse isn’t present we need the touchpad
# Reenable Touchpad and configure pad-clicks
# RTCornerButton is the Right Top Corner on the touchpad
# The value 3 maps it as the right click button
# RBCornerButton is the Right Bottom Corner on the touchpad
# The value 2 maps it as the middle click button
#synclient TouchpadOff=0 MaxTapTime=150 ClickFinger1=1 ClickFinger2=2 ClickFinger3=3 RTCornerButton=3 RBCornerButton=2;
# Forces break of touchpad functions while typing if the touchpad is enabled.
# Adds a 3 second interval following keyboard use which helps to prevent the
# mouse from jumping while typing & resting hands on restpad or the touchpad
#syndaemon -i 3 -d;

# custom for asus f8p
xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 1

# wait 2 seconds and poll the mouse state again
sleep 2

sleep 15

Its main task is to check the existence of a given mouse. If the mouse exists, it will disable touchpad by using xinput command. If not, it will enable touchpad. That’s simply.

Below is where you need to customize for your own machine.

1. Use xinput to get the name of your usb mouse, and replace ‘Logitech USB Laser Mouse’.

if xinput list ‘Logitech USB Laser Mouse’;

2. Use xinput to get the name of your touchpad device, and replace “SynPS/2 Synaptics TouchPad”.

xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0

xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 1

3. Save your script somewhere (I put in my home directory). Mark it executable.

4. Run the script and test it: plug on/off your usb mouse. If test works, do last step.

5. Go to Startup Applications, add this script.

You will no longer worry about discomfort with the touchpad. It works perfectly like a feature of Synaptics utility for Asus laptop.

Disable touchpad in Linux Mint

November 2nd, 2010 3 comments

Laptop users often have this desire: disable touchpad when usb mouse is connected to machine. For Windows, we can do this by installing Synaptics utility, then turning on the right feature. For Linux Mint / Ubuntu, there are tools to do so but that may not work stably all the time. I try GPointing Device, the touchpad is suddenly turned ON after a while I turn it OFF. That’s really headache when you work with your laptop for hours.

Some solution refers to modifying /etc/X11/xorg.conf but this file does not exist in Linux Mint 9, even if I add it and use synclient command, this way dooes not work for me.

Finally I find out a useful command, xinput, which can totally disable touchpad in a session. If you’re in same situation like me and looking for a solution that works, read on. If you’d like to learn more, read this Ubuntu wiki:

First, list all current input devices.

administrator@linuxmint ~ $ xinput list
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB Laser Mouse                    id=10    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                  id=12    [slave  pointer  (2)]
⎜   ↳ Macintosh mouse button emulation            id=13    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
↳ Power Button                                id=6    [slave  keyboard (3)]
↳ Video Bus                                   id=7    [slave  keyboard (3)]
↳ Sleep Button                                id=8    [slave  keyboard (3)]
↳ USB 2.0 Camera                              id=9    [slave  keyboard (3)]
↳ AT Translated Set 2 keyboard                id=11    [slave  keyboard (3)]
↳ Asus Laptop extra buttons                   id=14    [slave  keyboard (3)]

List properties of specific device.

administrator@linuxmint ~ $ xinput list-props “SynPS/2 Synaptics TouchPad”
Device ‘SynPS/2 Synaptics TouchPad’:
Device Enabled (140):    0
Device Accel Profile (257):    0
Device Accel Constant Deceleration (258):    1.000000
Device Accel Adaptive Deceleration (260):    1.000000

Set property “Device Enabled” to 0 to disable the device.

administrator@linuxmint ~ $ xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0

It works instantly without restarting :D . You can save the last command line as a an executable script, put it on Desktop, click whenever you want.

Now you feel better  yet? Or still don’t like to type command line? Then this wiki may be helpful There is section about how to disable touchpad that really works.

Stardict dictionary for Ubuntu

November 2nd, 2010 No comments

I am switching to Ubuntu from Windows. I still find a good alternative software to Babylon dictionary. The following post by Shevin satisfies my need. Thanks to the author.


Have you missed the Babylon program under windows , with all those good dictionaries?
here I will tell you how to make Babylon dictionaries work under ubuntu .

StarDict works like Babylon it is resident in memory , you select the word and it will show the definition in a small pop-up window fastly, ofcourse you can change the keys . (I changed it so when I press WIN key it show me the definition of the selected word) you can install StarDict using synaptic package manager easily .

How to make the Babylon dictionaries work in ubuntu(stardict)?

they have some dictionaries on StarDict site but compared to Babylon dictionaries they are so few.. first go to Babylon site and download the dictionary which you want to use , (I download Kurdish and Farsi ones)

Now we should convert the downloaded dictionary to StarDict format ,
there is a program named dictconv , to convert dictionary formats to each other (including Babylon to StarDict)

here we go :
1- download dictconv here . you should install it by source (don’t loose your pants , it is not hard)

2-Extract the zipped file which you downloaded , somewhere in your desktop .
3-Before we continue , open synaptic package manager and install “libxml2-dev” as it is needed for our program .

then go to the folder on the desktop

cd dictconv

4-then enter this :

sudo ./configure

5- if the previous thing was done without any error continue , if it gave you error , (it usualy tells you , you need to install something) solve the error and continue :

sudo make all install

Now it is installed ! but we still need another program
again go to synaptic package manager and install “dictzip”.

now here we go to convert the bayblon dictionary : for example mine is Farsi.BGL
I copy it to the desktop then

cd Desktop


dictconv Farsi.BGL -o Farsi.ifo

in this example Farsi.BGL is the one which I downloaded from Babylon site and Farsi.ifo is the name of the output file which I want to make .

if you have done it successfully ,it should generate 3 files !

one of those 3 generated files is Farsi.dict (Farsi in my case)
now we should do this :

dictzip Farsi.dict

this command changes our .dict file to .dz !

now we should have three files

create a folder on your desktop and move these 3 files to that folder .
and move those generated files to there , in my case I created Farsi in desktop and moved them
to the Farsi folder .

now we should move the whole things to the StarDict folder

sudo mv Farsi /usr/share/stardict/dic

and now I restart the StarDict and click on the “manager dictionaries” (it is in the Right Bottom corner of the window) and Enable the Farsi dictionary.

Thats all folks . I am enjoying Babylon dictionary under ubuntu !


How To Install Microsoft Office 2007 In Ubuntu 9.04

October 1st, 2010 No comments

(Written By Saman Sadeghi, June 22nd, 2009


This step-by-step walk through details installing Microsoft Office 2007 Professional on Ubuntu 9.04, “Intrepid Ibex”.

I have to admit that I absolutely love Office 12, I’ve be using it on Ubuntu since 8.04 and OpenOffice just doesn’t compare! So, I needed to install Office 2007 onto Ubuntu 9.04 (as I did a clean install). If you do too, follow along with my handy guide!

Uninstall Previous Versions Of Wine

For some odd reason, Office 2007 will not run on a version of Wine above 1.1.14. For that reason, if you currently have Wine installed, uninstall it by follow these steps:

  1. Open the terminal.
  2. Enter the following:
    sudo apt-get remove wine
  3. Remove the hidden Wine folder by entering the following into the terminal:
    rm -rf ~/.wine

Install Wine

I’ll be using Wine 1.1.14 as I know it works.

  1. Open Firefox and navigate to the The WineHQ .deb Packages Archives and download Wine 1.1.14 for your system architecture.
  2. Install the .deb
  3. You will see a dialog box that reads: “An older version is available in the software channel.”
  4. Click the “Close” button.
  5. Click the “Install Package” button.
  6. Enter your password to install Wine.

Install Microsoft Office 2007

Now the fun part!

  1. Insert your Microsoft Office 2007 install disc into your computer’s CD-ROM drive.
  2. Look for the setup.exe executable.
  3. Right-click the installer and click “Open with other application”
  4. Choose Wine Windows Program Loader.
  5. Enter your serial number.
  6. Accept the User Agreement.
  7. Click the large “Install Now” button

    If you click the Customize button, you can chose which components you want to install. You can also enter your name, initials and company name. This information will be embedded into every document that you create, just like in the PC version.

Install Winetricks

  1. Switch back to the terminal and enter the following:
    sudo wget
  2. Once complete, enter this command:
    sudo apt-get install cabextract
  3. Enter the following:
    sh winetricks corefonts tahoma vcrun2005sp1 wsh56js
  4. Agree the Visual C++ license agreement.
  5. Click the “Yes” button to install Windows Script 5.6
  6. Agree to the license agreement.

Configure Wine

  1. Enter the following into the terminal:
  2. Switch to the Libraries tab
  3. In the New override for libraries combo box, enter: riched20 and click the “Add” button
  4. With riched20 highlighted, click the “Edit” button.
  5. Select the “Native (Windows)” radio button and click the “OK” button.
  6. Enter usp10 into the New override for libraries combo box.
  7. Click the “OK” button to close the Wine configuration dialog box.

Test Microsoft Office 2007

All of the Microsoft Office applications should now have appeared in your application menu: Applications->Wine->Programs->Microsoft Office