Archive

Posts Tagged ‘Ubuntu’

Adding/Removing Shell scripts

June 26th, 2009

Original Post From: StringOfThoughts

Adding a script

First of all write a script, say test.sh and put it in the directory /etc/init.d . Next we need to make it executable so.

$ sudo chmod +x test.sh

You can check if the script is working by issuing

$ sudo ./test.sh

Assuming the script is working as expected, to make the script run at startup / reboot.

$ sudo update-rc.d -f test.sh start 99 2 3 4 5 . // Run at startup
$ sudo update-rc.d -f test.sh start 1 0 6 .      // Run at reboot

Just a reminder there is dot (.) at the end of command. Don’t forget that!! Now you are done adding a script to run at startup.

Removing a script.

Just a reminder for new users, don’t just go to /etc/init.d and delete the script file :) that wouldn’t help and may cause you trouble. We need a nice little application called rcconf (Debian runlevel configuration tool)

$ sudo apt-get install rcconf

then run rcconf (only root can run rcconf)

$ sudo rcconf

rcconf1

The interface is very simple. It lists the scripts so all you need to do is find out where is your script and toggle “*” using space bar and then select OK. That’s all. The script is now removed but still present in the directory /etc/init.d but you can safely delete it now.

Bonus: My shell script to launch JasperServer at start up:

#!/bin/sh
/opt/jasperserver-3.1/jasperctl.sh start

Coding , , , , ,

Virtual CD/DVD Driver in Ubuntu

June 19th, 2009

Do you want a virtual CD/DVD software like MagicDisc or DAEMON Tools in Windows for your Ubuntu/Linux machine? I can introduce you an acceptable (and free) one: AcetoneISO

AcetoneISO

AcetoneISO, is a feature-rich and complete software application to manage CD/DVD images. Thanks to powerful open source tools such as fuseiso, AcetoneISO will let You mount typical proprietary images formats of the Windows world such as ISO BIN NRG MDF IMG and do plenty of other things.

- From AcetoneISO Homepage

The use of AcetoneISO is pretty easy and much similar to DAEMON Tools. Just give AcetoneISO a try, and save time of burning a CD/DVD :)

P/S: By the way, you can find some interesting information of how to mount a ISO file at UbuntuForums.

Administration, Tips , , , ,

How to view .CHM files in Ubuntu

June 18th, 2009

Original Post From: GiannisTsakiris.com

It is easy to open and view Microsoft Compiled HTML Help files (.chm) from Ubuntu. You actually have at least two options: xchm or gnochm.

To install xchm run the following command:

$ sudo apt-get install xchm

To install gnochm run:

$ sudo apt-get install gnochm

To view a .chm file using xchm you just have to run:

$ xchm chm-file

Alternative to open it with gnochm simply run:

$ gnochm chm-file

Or in a simplier way, you can just double-click on the file’s icon.

Tips ,

MySQL error 1045 (28000): Access denied for user …

June 16th, 2009

Hello everybody,

Today, my task is configuring a MySQL server to allow connections from remote computers. The problem I has met is that although port 3306 on the router was already opened, users from internet still could not connect to my MySQL Server. Here is my error message:

tuyent@local:~$ mysql -u tuyent -p -h remote-computer
Enter password: 
ERROR 1045 (28000): Access denied for user 'tuyent'@'local' (using password: YES)

Well, here is my solution:
- Step 1: Double check that the port 3306 is already opened.
- Step 2: Open MySQL configuration file (/etc/mysql/my.cnf), comment the line

# bind-address            = 127.0.0.1

- Step 3: Restart the MySQL server

$ sudo /etc/init.d/mysql restart

- Step 4: Go to mysql command line and grant permission for user

mysql> grant all on *.* to 'tuyent'@'%' identified by 'password';
mysql> grant all on *.* to 'tuyent'@'localhost' identified by 'password';
mysql> flush privileges;

Note: Remember to grant permission on both from localhost and from anywhere (’%’ indicator), and flush all privileges.

Works fine for me :)

Administration, Coding , , , , ,

Linux Remote Desktop For Controlling Windows (rdesktop)

June 15th, 2009

I am responsible for couple of windows servers and windows xp workstations too. When I work from home, I need a way to get into Windows XP/2000/Vista/2003 server for work.

rdesktop

Since I have Debain Linux at home, I needed a way to login into Microsoft windows desktop from Linux OS. Many of us working at tech support use rdesktop to connect to customers’ windows XP box.

Especially it is very useful to configure Outlook or something else when customers do not understand how to configure or troubleshoot problem. This is the best way to fix a problem.

Fortunately, Linux has rdesktop utility. It is a client for remote desktop protocol (RDP), used in a number of Microsoft products including Windows NT Terminal Server, Windows 2000 Server, Windows XP and Windows 2003 Server. You do not need to install VNC server. All you need is rdesktop client on Linux or BSD workstation.

Install rdesktop

$ sudo apt-get install rdesktop

Connect to MS Windows 2000/2003 server from Linux, type the following command at a shell prompt (connect to Windows server called mw2sn100.mycorp.com)

$ rdesktop mw2sn100.mycorp.com

Or connect to windows XP/Vista workstation having IP 192.168.1.17:

$ rdesktop 192.168.1.17

Please note that you must first enable remote desktop connection under Windows Server/XP.

* Go to Windows XP Desktop
* Right Click on My Computer
* Select properties
* Select Remote tab
* Enable Remote desktop.
* Save the changes.

Make sure enterprise firewall allows incoming connection on TCP port 3389. rdesktop supports many other options, see man page of rdesktop or visit main website of rdesktop for more information.

Original Post from: cyberciti.biz

Administration , , , ,

SSH Tunnel + SOCKS Proxy Forwarding = Secure Browsing

June 15th, 2009

When you are at the coffee shop, or at a conference, and you are not sure that you want to send all your data over the wi-fi network in plaintext, you want a secure tunnel to browse. This happened to me recently and I stumbled across a neat feature of OpenSSH (the ssh client on everyone’s computer). The wonders of ssh never cease to amaze me!

You can use the “-D” flag of openssh to create a SOCKS proxy.

The command first:

$ ssh -D 9999 username@ip-address-of-ssh-server

This of course connects you to the server specified by “ip-address-of-ssh-server”. Needless to say, you (username) must have an ssh account on the server. In addition, this will create a SOCKS proxy on port “9999″ of your computer. This is a tunnel to the server. Now all you have to do is set the preference in Firefox to use a SOCKS proxy. The proxy is, of course, “localhost”, with the port 9999.

Now when you browse, all the connections you make to websites will seem to originate from the server to which you SSH-ed. In addition, all outgoing and incoming data for the browsing session will be encrypted since it passes through the SSH connection.

Source: Ubuntu Blog

Administration , , ,